// Generated by Construct 3, the game and app creator :: https://www.construct.net
'use strict';"use strict";
(function(e,b){"object"===typeof exports&&"undefined"!==typeof module?b(exports):"function"===typeof define&&define.amd?define(["exports"],b):(e="undefined"!==typeof globalThis?globalThis:e||self,b(e.glMatrix={}))})(this,function(e){function b(k,n,v){var z=n[0],C=n[1],E=n[2];n=n[3];var H=v[0],K=v[1],M=v[2];v=v[3];k[0]=z*H+E*K;k[1]=C*H+n*K;k[2]=z*M+E*v;k[3]=C*M+n*v;return k}function a(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];return k}function d(k,n,v){var z=n[0],C=n[1],E=
n[2],H=n[3],K=n[4];n=n[5];var M=v[0],O=v[1],R=v[2],T=v[3],Y=v[4];v=v[5];k[0]=z*M+E*O;k[1]=C*M+H*O;k[2]=z*R+E*T;k[3]=C*R+H*T;k[4]=z*Y+E*v+K;k[5]=C*Y+H*v+n;return k}function c(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];k[4]=n[4]-v[4];k[5]=n[5]-v[5];return k}function f(){var k=new sa(9);sa!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[5]=0,k[6]=0,k[7]=0);k[0]=1;k[4]=1;k[8]=1;return k}function h(k,n,v){var z=n[0],C=n[1],E=n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7];n=n[8];var T=v[0],Y=v[1],
X=v[2],fa=v[3],ha=v[4],ba=v[5],qa=v[6],ka=v[7];v=v[8];k[0]=T*z+Y*H+X*O;k[1]=T*C+Y*K+X*R;k[2]=T*E+Y*M+X*n;k[3]=fa*z+ha*H+ba*O;k[4]=fa*C+ha*K+ba*R;k[5]=fa*E+ha*M+ba*n;k[6]=qa*z+ka*H+v*O;k[7]=qa*C+ka*K+v*R;k[8]=qa*E+ka*M+v*n;return k}function g(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];k[4]=n[4]-v[4];k[5]=n[5]-v[5];k[6]=n[6]-v[6];k[7]=n[7]-v[7];k[8]=n[8]-v[8];return k}function l(k){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=1;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=0;
k[13]=0;k[14]=0;k[15]=1;return k}function m(k,n,v){var z=n[0],C=n[1],E=n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=n[8],Y=n[9],X=n[10],fa=n[11],ha=n[12],ba=n[13],qa=n[14];n=n[15];var ka=v[0],ta=v[1],ua=v[2],ra=v[3];k[0]=ka*z+ta*K+ua*T+ra*ha;k[1]=ka*C+ta*M+ua*Y+ra*ba;k[2]=ka*E+ta*O+ua*X+ra*qa;k[3]=ka*H+ta*R+ua*fa+ra*n;ka=v[4];ta=v[5];ua=v[6];ra=v[7];k[4]=ka*z+ta*K+ua*T+ra*ha;k[5]=ka*C+ta*M+ua*Y+ra*ba;k[6]=ka*E+ta*O+ua*X+ra*qa;k[7]=ka*H+ta*R+ua*fa+ra*n;ka=v[8];ta=v[9];ua=v[10];ra=v[11];k[8]=ka*z+ta*K+
ua*T+ra*ha;k[9]=ka*C+ta*M+ua*Y+ra*ba;k[10]=ka*E+ta*O+ua*X+ra*qa;k[11]=ka*H+ta*R+ua*fa+ra*n;ka=v[12];ta=v[13];ua=v[14];ra=v[15];k[12]=ka*z+ta*K+ua*T+ra*ha;k[13]=ka*C+ta*M+ua*Y+ra*ba;k[14]=ka*E+ta*O+ua*X+ra*qa;k[15]=ka*H+ta*R+ua*fa+ra*n;return k}function u(k,n,v){var z=n[0],C=n[1],E=n[2],H=n[3],K=z+z,M=C+C,O=E+E;n=z*K;var R=z*M;z*=O;var T=C*M;C*=O;E*=O;K*=H;M*=H;H*=O;k[0]=1-(T+E);k[1]=R+H;k[2]=z-M;k[3]=0;k[4]=R-H;k[5]=1-(n+E);k[6]=C+K;k[7]=0;k[8]=z+M;k[9]=C-K;k[10]=1-(n+T);k[11]=0;k[12]=v[0];k[13]=
v[1];k[14]=v[2];k[15]=1;return k}function w(k,n){k[0]=n[12];k[1]=n[13];k[2]=n[14];return k}function q(k,n){var v=n[4],z=n[5],C=n[6],E=n[8],H=n[9],K=n[10];k[0]=Math.hypot(n[0],n[1],n[2]);k[1]=Math.hypot(v,z,C);k[2]=Math.hypot(E,H,K);return k}function t(k,n){var v=new sa(3);q(v,n);var z=1/v[0],C=1/v[1],E=1/v[2],H=n[0]*z;v=n[1]*C;var K=n[2]*E,M=n[4]*z,O=n[5]*C,R=n[6]*E;z*=n[8];C*=n[9];n=n[10]*E;E=H+O+n;0<E?(H=2*Math.sqrt(E+1),k[3]=.25*H,k[0]=(R-C)/H,k[1]=(z-K)/H,k[2]=(v-M)/H):H>O&&H>n?(H=2*Math.sqrt(1+
H-O-n),k[3]=(R-C)/H,k[0]=.25*H,k[1]=(v+M)/H,k[2]=(z+K)/H):O>n?(H=2*Math.sqrt(1+O-H-n),k[3]=(z-K)/H,k[0]=(v+M)/H,k[1]=.25*H,k[2]=(R+C)/H):(H=2*Math.sqrt(1+n-H-O),k[3]=(v-M)/H,k[0]=(z+K)/H,k[1]=(R+C)/H,k[2]=.25*H);return k}function p(k,n,v,z,C){n=1/Math.tan(n/2);k[0]=n/v;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[11]=-1;k[12]=0;k[13]=0;k[15]=0;null!=C&&Infinity!==C?(v=1/(z-C),k[10]=(C+z)*v,k[14]=2*C*z*v):(k[10]=-1,k[14]=-2*z);return k}function r(k,n,v,z,C,E,H){var K=1/(n-v),M=
1/(z-C),O=1/(E-H);k[0]=-2*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=-2*M;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=2*O;k[11]=0;k[12]=(n+v)*K;k[13]=(C+z)*M;k[14]=(H+E)*O;k[15]=1;return k}function x(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];k[4]=n[4]-v[4];k[5]=n[5]-v[5];k[6]=n[6]-v[6];k[7]=n[7]-v[7];k[8]=n[8]-v[8];k[9]=n[9]-v[9];k[10]=n[10]-v[10];k[11]=n[11]-v[11];k[12]=n[12]-v[12];k[13]=n[13]-v[13];k[14]=n[14]-v[14];k[15]=n[15]-v[15];return k}function y(){var k=new sa(3);sa!=Float32Array&&
(k[0]=0,k[1]=0,k[2]=0);return k}function D(k){return Math.hypot(k[0],k[1],k[2])}function G(k,n,v){var z=new sa(3);z[0]=k;z[1]=n;z[2]=v;return z}function A(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];return k}function F(k,n,v){k[0]=n[0]*v[0];k[1]=n[1]*v[1];k[2]=n[2]*v[2];return k}function J(k,n,v){k[0]=n[0]/v[0];k[1]=n[1]/v[1];k[2]=n[2]/v[2];return k}function B(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1],n[2]-k[2])}function I(k,n){var v=n[0]-k[0],z=n[1]-k[1];k=n[2]-k[2];return v*v+z*z+k*k}function L(k){var n=
k[0],v=k[1];k=k[2];return n*n+v*v+k*k}function Q(k,n){var v=n[0],z=n[1],C=n[2];v=v*v+z*z+C*C;0<v&&(v=1/Math.sqrt(v));k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;return k}function S(k,n){return k[0]*n[0]+k[1]*n[1]+k[2]*n[2]}function U(k,n,v){var z=n[0],C=n[1];n=n[2];var E=v[0],H=v[1];v=v[2];k[0]=C*v-n*H;k[1]=n*E-z*v;k[2]=z*H-C*E;return k}function V(){var k=new sa(4);sa!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0,k[3]=0);return k}function Z(k){var n=new sa(4);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];return n}function ma(k,
n,v,z){var C=new sa(4);C[0]=k;C[1]=n;C[2]=v;C[3]=z;return C}function va(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];return k}function Na(k,n,v,z,C){k[0]=n;k[1]=v;k[2]=z;k[3]=C;return k}function Ea(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];k[3]=n[3]+v[3];return k}function Ia(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];k[2]=n[2]-v[2];k[3]=n[3]-v[3];return k}function Ma(k,n,v){k[0]=n[0]*v[0];k[1]=n[1]*v[1];k[2]=n[2]*v[2];k[3]=n[3]*v[3];return k}function Fa(k,n,v){k[0]=n[0]/v[0];k[1]=n[1]/v[1];k[2]=
n[2]/v[2];k[3]=n[3]/v[3];return k}function ya(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;return k}function na(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1],n[2]-k[2],n[3]-k[3])}function Va(k,n){var v=n[0]-k[0],z=n[1]-k[1],C=n[2]-k[2];k=n[3]-k[3];return v*v+z*z+C*C+k*k}function xa(k){return Math.hypot(k[0],k[1],k[2],k[3])}function Ga(k){var n=k[0],v=k[1],z=k[2];k=k[3];return n*n+v*v+z*z+k*k}function bb(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var E=v*v+z*z+C*C+n*n;0<E&&(E=1/Math.sqrt(E));k[0]=
v*E;k[1]=z*E;k[2]=C*E;k[3]=n*E;return k}function Xa(k,n){return k[0]*n[0]+k[1]*n[1]+k[2]*n[2]+k[3]*n[3]}function ob(k,n,v,z){var C=n[0],E=n[1],H=n[2];n=n[3];k[0]=C+z*(v[0]-C);k[1]=E+z*(v[1]-E);k[2]=H+z*(v[2]-H);k[3]=n+z*(v[3]-n);return k}function pb(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]}function cb(){var k=new sa(4);sa!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0);k[3]=1;return k}function qb(k,n,v){v*=.5;var z=Math.sin(v);k[0]=z*n[0];k[1]=z*n[1];k[2]=z*n[2];k[3]=Math.cos(v);return k}
function rb(k,n,v){var z=n[0],C=n[1],E=n[2];n=n[3];var H=v[0],K=v[1],M=v[2];v=v[3];k[0]=z*v+n*H+C*M-E*K;k[1]=C*v+n*K+E*H-z*M;k[2]=E*v+n*M+z*K-C*H;k[3]=n*v-z*H-C*K-E*M;return k}function sb(k,n,v){v*=.5;var z=n[0],C=n[1],E=n[2];n=n[3];var H=Math.sin(v);v=Math.cos(v);k[0]=z*v+n*H;k[1]=C*v+E*H;k[2]=E*v-C*H;k[3]=n*v-z*H;return k}function tb(k,n,v){v*=.5;var z=n[0],C=n[1],E=n[2];n=n[3];var H=Math.sin(v);v=Math.cos(v);k[0]=z*v-E*H;k[1]=C*v+n*H;k[2]=E*v+z*H;k[3]=n*v-C*H;return k}function ub(k,n,v){v*=.5;
var z=n[0],C=n[1],E=n[2];n=n[3];var H=Math.sin(v);v=Math.cos(v);k[0]=z*v+C*H;k[1]=C*v-z*H;k[2]=E*v+n*H;k[3]=n*v-E*H;return k}function vb(k,n){var v=n[0],z=n[1],C=n[2],E=Math.sqrt(v*v+z*z+C*C);n=Math.exp(n[3]);var H=0<E?n*Math.sin(E)/E:0;k[0]=v*H;k[1]=z*H;k[2]=C*H;k[3]=n*Math.cos(E);return k}function wb(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var E=Math.sqrt(v*v+z*z+C*C);E=0<E?Math.atan2(E,n)/E:0;k[0]=v*E;k[1]=z*E;k[2]=C*E;k[3]=.5*Math.log(v*v+z*z+C*C+n*n);return k}function db(k,n,v,z){var C=n[0],E=n[1],
H=n[2];n=n[3];var K=v[0],M=v[1],O=v[2];v=v[3];var R=C*K+E*M+H*O+n*v;0>R&&(R=-R,K=-K,M=-M,O=-O,v=-v);if(1E-6<1-R){var T=Math.acos(R);var Y=Math.sin(T);R=Math.sin((1-z)*T)/Y;z=Math.sin(z*T)/Y}else R=1-z;k[0]=R*C+z*K;k[1]=R*E+z*M;k[2]=R*H+z*O;k[3]=R*n+z*v;return k}function xb(k,n){var v=n[0]+n[4]+n[8];if(0<v)v=Math.sqrt(v+1),k[3]=.5*v,v=.5/v,k[0]=(n[5]-n[7])*v,k[1]=(n[6]-n[2])*v,k[2]=(n[1]-n[3])*v;else{var z=0;n[4]>n[0]&&(z=1);n[8]>n[3*z+z]&&(z=2);var C=(z+1)%3,E=(z+2)%3;v=Math.sqrt(n[3*z+z]-n[3*C+C]-
n[3*E+E]+1);k[z]=.5*v;v=.5/v;k[3]=(n[3*C+E]-n[3*E+C])*v;k[C]=(n[3*C+z]+n[3*z+C])*v;k[E]=(n[3*E+z]+n[3*z+E])*v}return k}function yb(k,n,v){var z=.5*v[0],C=.5*v[1];v=.5*v[2];var E=n[0],H=n[1],K=n[2];n=n[3];k[0]=E;k[1]=H;k[2]=K;k[3]=n;k[4]=z*n+C*K-v*H;k[5]=C*n+v*E-z*K;k[6]=v*n+z*H-C*E;k[7]=-z*E-C*H-v*K;return k}function zb(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];return k}function eb(k,n,v){var z=n[0],C=n[1],E=n[2],H=n[3],K=v[4],M=v[5],O=v[6],R=v[7],T=n[4],
Y=n[5],X=n[6];n=n[7];var fa=v[0],ha=v[1],ba=v[2];v=v[3];k[0]=z*v+H*fa+C*ba-E*ha;k[1]=C*v+H*ha+E*fa-z*ba;k[2]=E*v+H*ba+z*ha-C*fa;k[3]=H*v-z*fa-C*ha-E*ba;k[4]=z*R+H*K+C*O-E*M+T*v+n*fa+Y*ba-X*ha;k[5]=C*R+H*M+E*K-z*O+Y*v+n*ha+X*fa-T*ba;k[6]=E*R+H*O+z*M-C*K+X*v+n*ba+T*ha-Y*fa;k[7]=H*R-z*K-C*M-E*O+n*v-T*fa-Y*ha-X*ba;return k}function Wa(){var k=new sa(2);sa!=Float32Array&&(k[0]=0,k[1]=0);return k}function fb(k,n,v){k[0]=n[0]-v[0];k[1]=n[1]-v[1];return k}function gb(k,n,v){k[0]=n[0]*v[0];k[1]=n[1]*v[1];
return k}function Ya(k,n,v){k[0]=n[0]/v[0];k[1]=n[1]/v[1];return k}function hb(k,n){return Math.hypot(n[0]-k[0],n[1]-k[1])}function Ta(k,n){var v=n[0]-k[0];k=n[1]-k[1];return v*v+k*k}function ib(k){return Math.hypot(k[0],k[1])}function jb(k){var n=k[0];k=k[1];return n*n+k*k}var sa="undefined"!==typeof Float32Array?Float32Array:Array,Sa=Math.random,Ab=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var k=0,n=arguments.length;n--;)k+=arguments[n]*arguments[n];return Math.sqrt(k)});var Db=Object.freeze({__proto__:null,
EPSILON:1E-6,get ARRAY_TYPE(){return sa},RANDOM:Sa,ANGLE_ORDER:"zyx",setMatrixArrayType:function(k){sa=k},toRadian:function(k){return k*Ab},equals:function(k,n){return Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))}}),Eb=Object.freeze({__proto__:null,create:function(){var k=new sa(4);sa!=Float32Array&&(k[1]=0,k[2]=0);k[0]=1;k[3]=1;return k},clone:function(k){var n=new sa(4);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];return k},
identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=1;return k},fromValues:function(k,n,v,z){var C=new sa(4);C[0]=k;C[1]=n;C[2]=v;C[3]=z;return C},set:function(k,n,v,z,C){k[0]=n;k[1]=v;k[2]=z;k[3]=C;return k},transpose:function(k,n){if(k===n){var v=n[1];k[1]=n[2];k[2]=v}else k[0]=n[0],k[1]=n[2],k[2]=n[1],k[3]=n[3];return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var E=v*n-C*z;if(!E)return null;E=1/E;k[0]=n*E;k[1]=-z*E;k[2]=-C*E;k[3]=v*E;return k},adjoint:function(k,n){var v=n[0];k[0]=n[3];
k[1]=-n[1];k[2]=-n[2];k[3]=v;return k},determinant:function(k){return k[0]*k[3]-k[2]*k[1]},multiply:b,rotate:function(k,n,v){var z=n[0],C=n[1],E=n[2];n=n[3];var H=Math.sin(v);v=Math.cos(v);k[0]=z*v+E*H;k[1]=C*v+n*H;k[2]=z*-H+E*v;k[3]=C*-H+n*v;return k},scale:function(k,n,v){var z=n[1],C=n[2],E=n[3],H=v[0];v=v[1];k[0]=n[0]*H;k[1]=z*H;k[2]=C*v;k[3]=E*v;return k},fromRotation:function(k,n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=v;k[2]=-v;k[3]=n;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=
0;k[2]=0;k[3]=n[1];return k},str:function(k){return"mat2("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3])},LDU:function(k,n,v,z){k[2]=z[2]/z[0];v[0]=z[0];v[1]=z[1];v[3]=z[3]-k[2]*v[1];return[k,n,v]},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];k[3]=n[3]+v[3];return k},subtract:a,exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]},equals:function(k,n){var v=k[0],z=k[1],C=k[2];k=k[3];var E=n[0],H=n[1],
K=n[2];n=n[3];return Math.abs(v-E)<=1E-6*Math.max(1,Math.abs(v),Math.abs(E))&&Math.abs(z-H)<=1E-6*Math.max(1,Math.abs(z),Math.abs(H))&&Math.abs(C-K)<=1E-6*Math.max(1,Math.abs(C),Math.abs(K))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},multiplyScalar:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;return k},multiplyScalarAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;k[3]=n[3]+v[3]*z;return k},mul:b,sub:a}),Fb=Object.freeze({__proto__:null,
create:function(){var k=new sa(6);sa!=Float32Array&&(k[1]=0,k[2]=0,k[4]=0,k[5]=0);k[0]=1;k[3]=1;return k},clone:function(k){var n=new sa(6);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];return k},identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=1;k[4]=0;k[5]=0;return k},fromValues:function(k,n,v,z,C,E){var H=new sa(6);H[0]=k;H[1]=n;H[2]=v;H[3]=z;H[4]=C;H[5]=E;return H},set:function(k,n,v,z,C,E,H){k[0]=
n;k[1]=v;k[2]=z;k[3]=C;k[4]=E;k[5]=H;return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2],E=n[3],H=n[4];n=n[5];var K=v*E-z*C;if(!K)return null;K=1/K;k[0]=E*K;k[1]=-z*K;k[2]=-C*K;k[3]=v*K;k[4]=(C*n-E*H)*K;k[5]=(z*H-v*n)*K;return k},determinant:function(k){return k[0]*k[3]-k[1]*k[2]},multiply:d,rotate:function(k,n,v){var z=n[0],C=n[1],E=n[2],H=n[3],K=n[4];n=n[5];var M=Math.sin(v);v=Math.cos(v);k[0]=z*v+E*M;k[1]=C*v+H*M;k[2]=z*-M+E*v;k[3]=C*-M+H*v;k[4]=K;k[5]=n;return k},scale:function(k,n,v){var z=
n[1],C=n[2],E=n[3],H=n[4],K=n[5],M=v[0];v=v[1];k[0]=n[0]*M;k[1]=z*M;k[2]=C*v;k[3]=E*v;k[4]=H;k[5]=K;return k},translate:function(k,n,v){var z=n[0],C=n[1],E=n[2],H=n[3],K=n[4];n=n[5];var M=v[0];v=v[1];k[0]=z;k[1]=C;k[2]=E;k[3]=H;k[4]=z*M+E*v+K;k[5]=C*M+H*v+n;return k},fromRotation:function(k,n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=v;k[2]=-v;k[3]=n;k[4]=0;k[5]=0;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=n[1];k[4]=0;k[5]=0;return k},fromTranslation:function(k,n){k[0]=1;
k[1]=0;k[2]=0;k[3]=1;k[4]=n[0];k[5]=n[1];return k},str:function(k){return"mat2d("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],1)},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];k[3]=n[3]+v[3];k[4]=n[4]+v[4];k[5]=n[5]+v[5];return k},subtract:c,multiplyScalar:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;k[4]=n[4]*v;k[5]=n[5]*v;return k},multiplyScalarAndAdd:function(k,n,v,z){k[0]=n[0]+
v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;k[3]=n[3]+v[3]*z;k[4]=n[4]+v[4]*z;k[5]=n[5]+v[5]*z;return k},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]},equals:function(k,n){var v=k[0],z=k[1],C=k[2],E=k[3],H=k[4];k=k[5];var K=n[0],M=n[1],O=n[2],R=n[3],T=n[4];n=n[5];return Math.abs(v-K)<=1E-6*Math.max(1,Math.abs(v),Math.abs(K))&&Math.abs(z-M)<=1E-6*Math.max(1,Math.abs(z),Math.abs(M))&&Math.abs(C-O)<=1E-6*Math.max(1,Math.abs(C),Math.abs(O))&&
Math.abs(E-R)<=1E-6*Math.max(1,Math.abs(E),Math.abs(R))&&Math.abs(H-T)<=1E-6*Math.max(1,Math.abs(H),Math.abs(T))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},mul:d,sub:c}),Gb=Object.freeze({__proto__:null,create:f,fromMat4:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[4];k[4]=n[5];k[5]=n[6];k[6]=n[8];k[7]=n[9];k[8]=n[10];return k},clone:function(k){var n=new sa(9);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];n[8]=k[8];return n},copy:function(k,
n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];return k},fromValues:function(k,n,v,z,C,E,H,K,M){var O=new sa(9);O[0]=k;O[1]=n;O[2]=v;O[3]=z;O[4]=C;O[5]=E;O[6]=H;O[7]=K;O[8]=M;return O},set:function(k,n,v,z,C,E,H,K,M,O){k[0]=n;k[1]=v;k[2]=z;k[3]=C;k[4]=E;k[5]=H;k[6]=K;k[7]=M;k[8]=O;return k},identity:function(k){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=1;k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},transpose:function(k,n){if(k===n){var v=n[1],z=n[2],C=n[5];k[1]=n[3];
k[2]=n[6];k[3]=v;k[5]=n[7];k[6]=z;k[7]=C}else k[0]=n[0],k[1]=n[3],k[2]=n[6],k[3]=n[1],k[4]=n[4],k[5]=n[7],k[6]=n[2],k[7]=n[5],k[8]=n[8];return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2],E=n[3],H=n[4],K=n[5],M=n[6],O=n[7];n=n[8];var R=n*H-K*O,T=-n*E+K*M,Y=O*E-H*M,X=v*R+z*T+C*Y;if(!X)return null;X=1/X;k[0]=R*X;k[1]=(-n*z+C*O)*X;k[2]=(K*z-C*H)*X;k[3]=T*X;k[4]=(n*v-C*M)*X;k[5]=(-K*v+C*E)*X;k[6]=Y*X;k[7]=(-O*v+z*M)*X;k[8]=(H*v-z*E)*X;return k},adjoint:function(k,n){var v=n[0],z=n[1],C=n[2],E=n[3],
H=n[4],K=n[5],M=n[6],O=n[7];n=n[8];k[0]=H*n-K*O;k[1]=C*O-z*n;k[2]=z*K-C*H;k[3]=K*M-E*n;k[4]=v*n-C*M;k[5]=C*E-v*K;k[6]=E*O-H*M;k[7]=z*M-v*O;k[8]=v*H-z*E;return k},determinant:function(k){var n=k[3],v=k[4],z=k[5],C=k[6],E=k[7],H=k[8];return k[0]*(H*v-z*E)+k[1]*(-H*n+z*C)+k[2]*(E*n-v*C)},multiply:h,translate:function(k,n,v){var z=n[0],C=n[1],E=n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7];n=n[8];var T=v[0];v=v[1];k[0]=z;k[1]=C;k[2]=E;k[3]=H;k[4]=K;k[5]=M;k[6]=T*z+v*H+O;k[7]=T*C+v*K+R;k[8]=T*E+v*M+n;return k},
rotate:function(k,n,v){var z=n[0],C=n[1],E=n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7];n=n[8];var T=Math.sin(v);v=Math.cos(v);k[0]=v*z+T*H;k[1]=v*C+T*K;k[2]=v*E+T*M;k[3]=v*H-T*z;k[4]=v*K-T*C;k[5]=v*M-T*E;k[6]=O;k[7]=R;k[8]=n;return k},scale:function(k,n,v){var z=v[0];v=v[1];k[0]=z*n[0];k[1]=z*n[1];k[2]=z*n[2];k[3]=v*n[3];k[4]=v*n[4];k[5]=v*n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];return k},fromTranslation:function(k,n){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=1;k[5]=0;k[6]=n[0];k[7]=n[1];k[8]=1;return k},fromRotation:function(k,
n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=v;k[2]=0;k[3]=-v;k[4]=n;k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=0;k[4]=n[1];k[5]=0;k[6]=0;k[7]=0;k[8]=1;return k},fromMat2d:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=0;k[3]=n[2];k[4]=n[3];k[5]=0;k[6]=n[4];k[7]=n[5];k[8]=1;return k},fromQuat:function(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var E=v+v,H=z+z,K=C+C;v*=E;var M=z*E;z*=H;var O=C*E,R=C*H;C*=K;E*=n;H*=n;n*=K;k[0]=1-z-C;k[3]=M-n;k[6]=O+H;k[1]=M+n;k[4]=
1-v-C;k[7]=R-E;k[2]=O-H;k[5]=R+E;k[8]=1-v-z;return k},normalFromMat4:function(k,n){var v=n[0],z=n[1],C=n[2],E=n[3],H=n[4],K=n[5],M=n[6],O=n[7],R=n[8],T=n[9],Y=n[10],X=n[11],fa=n[12],ha=n[13],ba=n[14];n=n[15];var qa=v*K-z*H,ka=v*M-C*H,ta=v*O-E*H,ua=z*M-C*K,ra=z*O-E*K,za=C*O-E*M,Aa=R*ha-T*fa,Ba=R*ba-Y*fa;R=R*n-X*fa;var Ca=T*ba-Y*ha;T=T*n-X*ha;Y=Y*n-X*ba;X=qa*Y-ka*T+ta*Ca+ua*R-ra*Ba+za*Aa;if(!X)return null;X=1/X;k[0]=(K*Y-M*T+O*Ca)*X;k[1]=(M*R-H*Y-O*Ba)*X;k[2]=(H*T-K*R+O*Aa)*X;k[3]=(C*T-z*Y-E*Ca)*X;
k[4]=(v*Y-C*R+E*Ba)*X;k[5]=(z*R-v*T-E*Aa)*X;k[6]=(ha*za-ba*ra+n*ua)*X;k[7]=(ba*ta-fa*za-n*ka)*X;k[8]=(fa*ra-ha*ta+n*qa)*X;return k},projection:function(k,n,v){k[0]=2/n;k[1]=0;k[2]=0;k[3]=0;k[4]=-2/v;k[5]=0;k[6]=-1;k[7]=1;k[8]=1;return k},str:function(k){return"mat3("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+", "+k[8]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8])},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];
k[3]=n[3]+v[3];k[4]=n[4]+v[4];k[5]=n[5]+v[5];k[6]=n[6]+v[6];k[7]=n[7]+v[7];k[8]=n[8]+v[8];return k},subtract:g,multiplyScalar:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;k[4]=n[4]*v;k[5]=n[5]*v;k[6]=n[6]*v;k[7]=n[7]*v;k[8]=n[8]*v;return k},multiplyScalarAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;k[3]=n[3]+v[3]*z;k[4]=n[4]+v[4]*z;k[5]=n[5]+v[5]*z;k[6]=n[6]+v[6]*z;k[7]=n[7]+v[7]*z;k[8]=n[8]+v[8]*z;return k},exactEquals:function(k,n){return k[0]===
n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]&&k[6]===n[6]&&k[7]===n[7]&&k[8]===n[8]},equals:function(k,n){var v=k[0],z=k[1],C=k[2],E=k[3],H=k[4],K=k[5],M=k[6],O=k[7];k=k[8];var R=n[0],T=n[1],Y=n[2],X=n[3],fa=n[4],ha=n[5],ba=n[6],qa=n[7];n=n[8];return Math.abs(v-R)<=1E-6*Math.max(1,Math.abs(v),Math.abs(R))&&Math.abs(z-T)<=1E-6*Math.max(1,Math.abs(z),Math.abs(T))&&Math.abs(C-Y)<=1E-6*Math.max(1,Math.abs(C),Math.abs(Y))&&Math.abs(E-X)<=1E-6*Math.max(1,Math.abs(E),Math.abs(X))&&
Math.abs(H-fa)<=1E-6*Math.max(1,Math.abs(H),Math.abs(fa))&&Math.abs(K-ha)<=1E-6*Math.max(1,Math.abs(K),Math.abs(ha))&&Math.abs(M-ba)<=1E-6*Math.max(1,Math.abs(M),Math.abs(ba))&&Math.abs(O-qa)<=1E-6*Math.max(1,Math.abs(O),Math.abs(qa))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},mul:h,sub:g}),Hb=Object.freeze({__proto__:null,create:function(){var k=new sa(16);sa!=Float32Array&&(k[1]=0,k[2]=0,k[3]=0,k[4]=0,k[6]=0,k[7]=0,k[8]=0,k[9]=0,k[11]=0,k[12]=0,k[13]=0,k[14]=0);k[0]=1;k[5]=1;k[10]=
1;k[15]=1;return k},clone:function(k){var n=new sa(16);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];n[8]=k[8];n[9]=k[9];n[10]=k[10];n[11]=k[11];n[12]=k[12];n[13]=k[13];n[14]=k[14];n[15]=k[15];return n},copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=n[4];k[5]=n[5];k[6]=n[6];k[7]=n[7];k[8]=n[8];k[9]=n[9];k[10]=n[10];k[11]=n[11];k[12]=n[12];k[13]=n[13];k[14]=n[14];k[15]=n[15];return k},fromValues:function(k,n,v,z,C,E,H,K,M,O,R,T,Y,X,fa,ha){var ba=new sa(16);
ba[0]=k;ba[1]=n;ba[2]=v;ba[3]=z;ba[4]=C;ba[5]=E;ba[6]=H;ba[7]=K;ba[8]=M;ba[9]=O;ba[10]=R;ba[11]=T;ba[12]=Y;ba[13]=X;ba[14]=fa;ba[15]=ha;return ba},set:function(k,n,v,z,C,E,H,K,M,O,R,T,Y,X,fa,ha,ba){k[0]=n;k[1]=v;k[2]=z;k[3]=C;k[4]=E;k[5]=H;k[6]=K;k[7]=M;k[8]=O;k[9]=R;k[10]=T;k[11]=Y;k[12]=X;k[13]=fa;k[14]=ha;k[15]=ba;return k},identity:l,transpose:function(k,n){if(k===n){var v=n[1],z=n[2],C=n[3],E=n[6],H=n[7],K=n[11];k[1]=n[4];k[2]=n[8];k[3]=n[12];k[4]=v;k[6]=n[9];k[7]=n[13];k[8]=z;k[9]=E;k[11]=n[14];
k[12]=C;k[13]=H;k[14]=K}else k[0]=n[0],k[1]=n[4],k[2]=n[8],k[3]=n[12],k[4]=n[1],k[5]=n[5],k[6]=n[9],k[7]=n[13],k[8]=n[2],k[9]=n[6],k[10]=n[10],k[11]=n[14],k[12]=n[3],k[13]=n[7],k[14]=n[11],k[15]=n[15];return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2],E=n[3],H=n[4],K=n[5],M=n[6],O=n[7],R=n[8],T=n[9],Y=n[10],X=n[11],fa=n[12],ha=n[13],ba=n[14];n=n[15];var qa=v*K-z*H,ka=v*M-C*H,ta=v*O-E*H,ua=z*M-C*K,ra=z*O-E*K,za=C*O-E*M,Aa=R*ha-T*fa,Ba=R*ba-Y*fa,Ca=R*n-X*fa,Ja=T*ba-Y*ha,Pa=T*n-X*ha,Qa=Y*n-X*ba,
Da=qa*Qa-ka*Pa+ta*Ja+ua*Ca-ra*Ba+za*Aa;if(!Da)return null;Da=1/Da;k[0]=(K*Qa-M*Pa+O*Ja)*Da;k[1]=(C*Pa-z*Qa-E*Ja)*Da;k[2]=(ha*za-ba*ra+n*ua)*Da;k[3]=(Y*ra-T*za-X*ua)*Da;k[4]=(M*Ca-H*Qa-O*Ba)*Da;k[5]=(v*Qa-C*Ca+E*Ba)*Da;k[6]=(ba*ta-fa*za-n*ka)*Da;k[7]=(R*za-Y*ta+X*ka)*Da;k[8]=(H*Pa-K*Ca+O*Aa)*Da;k[9]=(z*Ca-v*Pa-E*Aa)*Da;k[10]=(fa*ra-ha*ta+n*qa)*Da;k[11]=(T*ta-R*ra-X*qa)*Da;k[12]=(K*Ba-H*Ja-M*Aa)*Da;k[13]=(v*Ja-z*Ba+C*Aa)*Da;k[14]=(ha*ka-fa*ua-ba*qa)*Da;k[15]=(R*ua-T*ka+Y*qa)*Da;return k},adjoint:function(k,
n){var v=n[0],z=n[1],C=n[2],E=n[3],H=n[4],K=n[5],M=n[6],O=n[7],R=n[8],T=n[9],Y=n[10],X=n[11],fa=n[12],ha=n[13],ba=n[14];n=n[15];var qa=v*K-z*H,ka=v*M-C*H,ta=v*O-E*H,ua=z*M-C*K,ra=z*O-E*K,za=C*O-E*M,Aa=R*ha-T*fa,Ba=R*ba-Y*fa,Ca=R*n-X*fa,Ja=T*ba-Y*ha,Pa=T*n-X*ha,Qa=Y*n-X*ba;k[0]=K*Qa-M*Pa+O*Ja;k[1]=C*Pa-z*Qa-E*Ja;k[2]=ha*za-ba*ra+n*ua;k[3]=Y*ra-T*za-X*ua;k[4]=M*Ca-H*Qa-O*Ba;k[5]=v*Qa-C*Ca+E*Ba;k[6]=ba*ta-fa*za-n*ka;k[7]=R*za-Y*ta+X*ka;k[8]=H*Pa-K*Ca+O*Aa;k[9]=z*Ca-v*Pa-E*Aa;k[10]=fa*ra-ha*ta+n*qa;k[11]=
T*ta-R*ra-X*qa;k[12]=K*Ba-H*Ja-M*Aa;k[13]=v*Ja-z*Ba+C*Aa;k[14]=ha*ka-fa*ua-ba*qa;k[15]=R*ua-T*ka+Y*qa;return k},determinant:function(k){var n=k[0],v=k[1],z=k[2],C=k[4],E=k[5],H=k[6],K=k[8],M=k[9],O=k[10],R=k[12],T=k[13],Y=k[14],X=n*E-v*C,fa=n*H-z*C,ha=v*H-z*E,ba=K*T-M*R,qa=K*Y-O*R,ka=M*Y-O*T;return k[7]*(n*ka-v*qa+z*ba)-k[3]*(C*ka-E*qa+H*ba)+k[15]*(K*ha-M*fa+O*X)-k[11]*(R*ha-T*fa+Y*X)},multiply:m,translate:function(k,n,v){var z=v[0],C=v[1];v=v[2];if(n===k)k[12]=n[0]*z+n[4]*C+n[8]*v+n[12],k[13]=n[1]*
z+n[5]*C+n[9]*v+n[13],k[14]=n[2]*z+n[6]*C+n[10]*v+n[14],k[15]=n[3]*z+n[7]*C+n[11]*v+n[15];else{var E=n[0];var H=n[1];var K=n[2];var M=n[3];var O=n[4];var R=n[5];var T=n[6];var Y=n[7];var X=n[8];var fa=n[9];var ha=n[10];var ba=n[11];k[0]=E;k[1]=H;k[2]=K;k[3]=M;k[4]=O;k[5]=R;k[6]=T;k[7]=Y;k[8]=X;k[9]=fa;k[10]=ha;k[11]=ba;k[12]=E*z+O*C+X*v+n[12];k[13]=H*z+R*C+fa*v+n[13];k[14]=K*z+T*C+ha*v+n[14];k[15]=M*z+Y*C+ba*v+n[15]}return k},scale:function(k,n,v){var z=v[0],C=v[1];v=v[2];k[0]=n[0]*z;k[1]=n[1]*z;
k[2]=n[2]*z;k[3]=n[3]*z;k[4]=n[4]*C;k[5]=n[5]*C;k[6]=n[6]*C;k[7]=n[7]*C;k[8]=n[8]*v;k[9]=n[9]*v;k[10]=n[10]*v;k[11]=n[11]*v;k[12]=n[12];k[13]=n[13];k[14]=n[14];k[15]=n[15];return k},rotate:function(k,n,v,z){var C=z[0],E=z[1];z=z[2];var H=Math.hypot(C,E,z);if(1E-6>H)return null;H=1/H;C*=H;E*=H;z*=H;var K=Math.sin(v);var M=Math.cos(v);var O=1-M;v=n[0];H=n[1];var R=n[2];var T=n[3];var Y=n[4];var X=n[5];var fa=n[6];var ha=n[7];var ba=n[8];var qa=n[9];var ka=n[10];var ta=n[11];var ua=C*C*O+M;var ra=E*
C*O+z*K;var za=z*C*O-E*K;var Aa=C*E*O-z*K;var Ba=E*E*O+M;var Ca=z*E*O+C*K;var Ja=C*z*O+E*K;C=E*z*O-C*K;E=z*z*O+M;k[0]=v*ua+Y*ra+ba*za;k[1]=H*ua+X*ra+qa*za;k[2]=R*ua+fa*ra+ka*za;k[3]=T*ua+ha*ra+ta*za;k[4]=v*Aa+Y*Ba+ba*Ca;k[5]=H*Aa+X*Ba+qa*Ca;k[6]=R*Aa+fa*Ba+ka*Ca;k[7]=T*Aa+ha*Ba+ta*Ca;k[8]=v*Ja+Y*C+ba*E;k[9]=H*Ja+X*C+qa*E;k[10]=R*Ja+fa*C+ka*E;k[11]=T*Ja+ha*C+ta*E;n!==k&&(k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);return k},rotateX:function(k,n,v){var z=Math.sin(v);v=Math.cos(v);var C=n[4],E=
n[5],H=n[6],K=n[7],M=n[8],O=n[9],R=n[10],T=n[11];n!==k&&(k[0]=n[0],k[1]=n[1],k[2]=n[2],k[3]=n[3],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[4]=C*v+M*z;k[5]=E*v+O*z;k[6]=H*v+R*z;k[7]=K*v+T*z;k[8]=M*v-C*z;k[9]=O*v-E*z;k[10]=R*v-H*z;k[11]=T*v-K*z;return k},rotateY:function(k,n,v){var z=Math.sin(v);v=Math.cos(v);var C=n[0],E=n[1],H=n[2],K=n[3],M=n[8],O=n[9],R=n[10],T=n[11];n!==k&&(k[4]=n[4],k[5]=n[5],k[6]=n[6],k[7]=n[7],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[0]=C*v-M*z;k[1]=E*v-O*
z;k[2]=H*v-R*z;k[3]=K*v-T*z;k[8]=C*z+M*v;k[9]=E*z+O*v;k[10]=H*z+R*v;k[11]=K*z+T*v;return k},rotateZ:function(k,n,v){var z=Math.sin(v);v=Math.cos(v);var C=n[0],E=n[1],H=n[2],K=n[3],M=n[4],O=n[5],R=n[6],T=n[7];n!==k&&(k[8]=n[8],k[9]=n[9],k[10]=n[10],k[11]=n[11],k[12]=n[12],k[13]=n[13],k[14]=n[14],k[15]=n[15]);k[0]=C*v+M*z;k[1]=E*v+O*z;k[2]=H*v+R*z;k[3]=K*v+T*z;k[4]=M*v-C*z;k[5]=O*v-E*z;k[6]=R*v-H*z;k[7]=T*v-K*z;return k},fromTranslation:function(k,n){k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=1;k[6]=0;
k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=n[0];k[13]=n[1];k[14]=n[2];k[15]=1;return k},fromScaling:function(k,n){k[0]=n[0];k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n[1];k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=n[2];k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromRotation:function(k,n,v){var z=v[0],C=v[1];v=v[2];var E=Math.hypot(z,C,v);if(1E-6>E)return null;E=1/E;z*=E;C*=E;v*=E;E=Math.sin(n);n=Math.cos(n);var H=1-n;k[0]=z*z*H+n;k[1]=C*z*H+v*E;k[2]=v*z*H-C*E;k[3]=0;k[4]=z*C*H-v*E;k[5]=C*C*H+n;k[6]=v*C*H+z*
E;k[7]=0;k[8]=z*v*H+C*E;k[9]=C*v*H-z*E;k[10]=v*v*H+n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromXRotation:function(k,n){var v=Math.sin(n);n=Math.cos(n);k[0]=1;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;k[6]=v;k[7]=0;k[8]=0;k[9]=-v;k[10]=n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromYRotation:function(k,n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=0;k[2]=-v;k[3]=0;k[4]=0;k[5]=1;k[6]=0;k[7]=0;k[8]=v;k[9]=0;k[10]=n;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromZRotation:function(k,
n){var v=Math.sin(n);n=Math.cos(n);k[0]=n;k[1]=v;k[2]=0;k[3]=0;k[4]=-v;k[5]=n;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=1;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},fromRotationTranslation:u,fromQuat2:function(k,n){var v=new sa(3),z=-n[0],C=-n[1],E=-n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=z*z+C*C+E*E+H*H;0<T?(v[0]=2*(K*H+R*z+M*E-O*C)/T,v[1]=2*(M*H+R*C+O*z-K*E)/T,v[2]=2*(O*H+R*E+K*C-M*z)/T):(v[0]=2*(K*H+R*z+M*E-O*C),v[1]=2*(M*H+R*C+O*z-K*E),v[2]=2*(O*H+R*E+K*C-M*z));u(k,n,v);return k},getTranslation:w,
getScaling:q,getRotation:t,decompose:function(k,n,v,z){n[0]=z[12];n[1]=z[13];n[2]=z[14];var C=z[0],E=z[1],H=z[2],K=z[4],M=z[5],O=z[6],R=z[8];n=z[9];z=z[10];v[0]=Math.hypot(C,E,H);v[1]=Math.hypot(K,M,O);v[2]=Math.hypot(R,n,z);var T=1/v[0],Y=1/v[1],X=1/v[2];v=C*T;E*=Y;H*=X;K*=T;M*=Y;O*=X;R*=T;n*=Y;z*=X;Y=v+M+z;0<Y?(z=2*Math.sqrt(Y+1),k[3]=.25*z,k[0]=(O-n)/z,k[1]=(R-H)/z,k[2]=(E-K)/z):v>M&&v>z?(z=2*Math.sqrt(1+v-M-z),k[3]=(O-n)/z,k[0]=.25*z,k[1]=(E+K)/z,k[2]=(R+H)/z):M>z?(z=2*Math.sqrt(1+M-v-z),k[3]=
(R-H)/z,k[0]=(E+K)/z,k[1]=.25*z,k[2]=(O+n)/z):(z=2*Math.sqrt(1+z-v-M),k[3]=(E-K)/z,k[0]=(R+H)/z,k[1]=(O+n)/z,k[2]=.25*z);return k},fromRotationTranslationScale:function(k,n,v,z){var C=n[0],E=n[1],H=n[2],K=n[3],M=C+C,O=E+E,R=H+H;n=C*M;var T=C*O;C*=R;var Y=E*O;E*=R;H*=R;M*=K;O*=K;K*=R;R=z[0];var X=z[1];z=z[2];k[0]=(1-(Y+H))*R;k[1]=(T+K)*R;k[2]=(C-O)*R;k[3]=0;k[4]=(T-K)*X;k[5]=(1-(n+H))*X;k[6]=(E+M)*X;k[7]=0;k[8]=(C+O)*z;k[9]=(E-M)*z;k[10]=(1-(n+Y))*z;k[11]=0;k[12]=v[0];k[13]=v[1];k[14]=v[2];k[15]=1;
return k},fromRotationTranslationScaleOrigin:function(k,n,v,z,C){var E=n[0],H=n[1],K=n[2],M=n[3],O=E+E,R=H+H,T=K+K;n=E*O;var Y=E*R,X=E*T;E=H*R;H*=T;var fa=K*T;K=M*O;R*=M;var ha=M*T,ba=z[0],qa=z[1];T=z[2];z=C[0];M=C[1];C=C[2];O=(1-(E+fa))*ba;var ka=(Y+ha)*ba;ba*=X-R;Y=(Y-ha)*qa;fa=(1-(n+fa))*qa;qa*=H+K;X=(X+R)*T;H=(H-K)*T;n=(1-(n+E))*T;k[0]=O;k[1]=ka;k[2]=ba;k[3]=0;k[4]=Y;k[5]=fa;k[6]=qa;k[7]=0;k[8]=X;k[9]=H;k[10]=n;k[11]=0;k[12]=v[0]+z-(O*z+Y*M+X*C);k[13]=v[1]+M-(ka*z+fa*M+H*C);k[14]=v[2]+C-(ba*z+
qa*M+n*C);k[15]=1;return k},fromQuat:function(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var E=v+v,H=z+z,K=C+C;v*=E;var M=z*E;z*=H;var O=C*E,R=C*H;C*=K;E*=n;H*=n;n*=K;k[0]=1-z-C;k[1]=M+n;k[2]=O-H;k[3]=0;k[4]=M-n;k[5]=1-v-C;k[6]=R+E;k[7]=0;k[8]=O+H;k[9]=R-E;k[10]=1-v-z;k[11]=0;k[12]=0;k[13]=0;k[14]=0;k[15]=1;return k},frustum:function(k,n,v,z,C,E,H){var K=1/(v-n),M=1/(C-z),O=1/(E-H);k[0]=2*E*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=2*E*M;k[6]=0;k[7]=0;k[8]=(v+n)*K;k[9]=(C+z)*M;k[10]=(H+E)*O;k[11]=-1;k[12]=0;k[13]=
0;k[14]=H*E*2*O;k[15]=0;return k},perspectiveNO:p,perspective:p,perspectiveZO:function(k,n,v,z,C){n=1/Math.tan(n/2);k[0]=n/v;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=n;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[11]=-1;k[12]=0;k[13]=0;k[15]=0;null!=C&&Infinity!==C?(v=1/(z-C),k[10]=C*v,k[14]=C*z*v):(k[10]=-1,k[14]=-z);return k},perspectiveFromFieldOfView:function(k,n,v,z){var C=Math.tan(n.upDegrees*Math.PI/180),E=Math.tan(n.downDegrees*Math.PI/180),H=Math.tan(n.leftDegrees*Math.PI/180);n=Math.tan(n.rightDegrees*Math.PI/
180);var K=2/(H+n),M=2/(C+E);k[0]=K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=M;k[6]=0;k[7]=0;k[8]=-((H-n)*K*.5);k[9]=(C-E)*M*.5;k[10]=z/(v-z);k[11]=-1;k[12]=0;k[13]=0;k[14]=z*v/(v-z);k[15]=0;return k},orthoNO:r,ortho:r,orthoZO:function(k,n,v,z,C,E,H){var K=1/(n-v),M=1/(z-C);H=1/(E-H);k[0]=-2*K;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=-2*M;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=H;k[11]=0;k[12]=(n+v)*K;k[13]=(C+z)*M;k[14]=E*H;k[15]=1;return k},lookAt:function(k,n,v,z){var C=n[0],E=n[1];n=n[2];var H=z[0];var K=z[1];var M=
z[2];var O=v[0];z=v[1];var R=v[2];if(1E-6>Math.abs(C-O)&&1E-6>Math.abs(E-z)&&1E-6>Math.abs(n-R))return l(k);v=C-O;z=E-z;O=n-R;var T=1/Math.hypot(v,z,O);v*=T;z*=T;O*=T;R=K*O-M*z;M=M*v-H*O;H=H*z-K*v;(T=Math.hypot(R,M,H))?(T=1/T,R*=T,M*=T,H*=T):H=M=R=0;K=z*H-O*M;var Y=O*R-v*H;var X=v*M-z*R;(T=Math.hypot(K,Y,X))?(T=1/T,K*=T,Y*=T,X*=T):X=Y=K=0;k[0]=R;k[1]=K;k[2]=v;k[3]=0;k[4]=M;k[5]=Y;k[6]=z;k[7]=0;k[8]=H;k[9]=X;k[10]=O;k[11]=0;k[12]=-(R*C+M*E+H*n);k[13]=-(K*C+Y*E+X*n);k[14]=-(v*C+z*E+O*n);k[15]=1;return k},
targetTo:function(k,n,v,z){var C=n[0],E=n[1];n=n[2];var H=z[0],K=z[1],M=z[2];z=C-v[0];var O=E-v[1];v=n-v[2];var R=z*z+O*O+v*v;0<R&&(R=1/Math.sqrt(R),z*=R,O*=R,v*=R);var T=K*v-M*O;M=M*z-H*v;H=H*O-K*z;R=T*T+M*M+H*H;0<R&&(R=1/Math.sqrt(R),T*=R,M*=R,H*=R);k[0]=T;k[1]=M;k[2]=H;k[3]=0;k[4]=O*H-v*M;k[5]=v*T-z*H;k[6]=z*M-O*T;k[7]=0;k[8]=z;k[9]=O;k[10]=v;k[11]=0;k[12]=C;k[13]=E;k[14]=n;k[15]=1;return k},str:function(k){return"mat4("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+
", "+k[8]+", "+k[9]+", "+k[10]+", "+k[11]+", "+k[12]+", "+k[13]+", "+k[14]+", "+k[15]+")"},frob:function(k){return Math.hypot(k[0],k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15])},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];k[3]=n[3]+v[3];k[4]=n[4]+v[4];k[5]=n[5]+v[5];k[6]=n[6]+v[6];k[7]=n[7]+v[7];k[8]=n[8]+v[8];k[9]=n[9]+v[9];k[10]=n[10]+v[10];k[11]=n[11]+v[11];k[12]=n[12]+v[12];k[13]=n[13]+v[13];k[14]=n[14]+v[14];k[15]=n[15]+v[15];return k},
subtract:x,multiplyScalar:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;k[4]=n[4]*v;k[5]=n[5]*v;k[6]=n[6]*v;k[7]=n[7]*v;k[8]=n[8]*v;k[9]=n[9]*v;k[10]=n[10]*v;k[11]=n[11]*v;k[12]=n[12]*v;k[13]=n[13]*v;k[14]=n[14]*v;k[15]=n[15]*v;return k},multiplyScalarAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;k[3]=n[3]+v[3]*z;k[4]=n[4]+v[4]*z;k[5]=n[5]+v[5]*z;k[6]=n[6]+v[6]*z;k[7]=n[7]+v[7]*z;k[8]=n[8]+v[8]*z;k[9]=n[9]+v[9]*z;k[10]=n[10]+v[10]*z;k[11]=n[11]+v[11]*
z;k[12]=n[12]+v[12]*z;k[13]=n[13]+v[13]*z;k[14]=n[14]+v[14]*z;k[15]=n[15]+v[15]*z;return k},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]&&k[6]===n[6]&&k[7]===n[7]&&k[8]===n[8]&&k[9]===n[9]&&k[10]===n[10]&&k[11]===n[11]&&k[12]===n[12]&&k[13]===n[13]&&k[14]===n[14]&&k[15]===n[15]},equals:function(k,n){var v=k[0],z=k[1],C=k[2],E=k[3],H=k[4],K=k[5],M=k[6],O=k[7],R=k[8],T=k[9],Y=k[10],X=k[11],fa=k[12],ha=k[13],ba=k[14];k=k[15];var qa=n[0],
ka=n[1],ta=n[2],ua=n[3],ra=n[4],za=n[5],Aa=n[6],Ba=n[7],Ca=n[8],Ja=n[9],Pa=n[10],Qa=n[11],Da=n[12],Bb=n[13],Cb=n[14];n=n[15];return Math.abs(v-qa)<=1E-6*Math.max(1,Math.abs(v),Math.abs(qa))&&Math.abs(z-ka)<=1E-6*Math.max(1,Math.abs(z),Math.abs(ka))&&Math.abs(C-ta)<=1E-6*Math.max(1,Math.abs(C),Math.abs(ta))&&Math.abs(E-ua)<=1E-6*Math.max(1,Math.abs(E),Math.abs(ua))&&Math.abs(H-ra)<=1E-6*Math.max(1,Math.abs(H),Math.abs(ra))&&Math.abs(K-za)<=1E-6*Math.max(1,Math.abs(K),Math.abs(za))&&Math.abs(M-Aa)<=
1E-6*Math.max(1,Math.abs(M),Math.abs(Aa))&&Math.abs(O-Ba)<=1E-6*Math.max(1,Math.abs(O),Math.abs(Ba))&&Math.abs(R-Ca)<=1E-6*Math.max(1,Math.abs(R),Math.abs(Ca))&&Math.abs(T-Ja)<=1E-6*Math.max(1,Math.abs(T),Math.abs(Ja))&&Math.abs(Y-Pa)<=1E-6*Math.max(1,Math.abs(Y),Math.abs(Pa))&&Math.abs(X-Qa)<=1E-6*Math.max(1,Math.abs(X),Math.abs(Qa))&&Math.abs(fa-Da)<=1E-6*Math.max(1,Math.abs(fa),Math.abs(Da))&&Math.abs(ha-Bb)<=1E-6*Math.max(1,Math.abs(ha),Math.abs(Bb))&&Math.abs(ba-Cb)<=1E-6*Math.max(1,Math.abs(ba),
Math.abs(Cb))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},mul:m,sub:x}),kb=function(){var k=y();return function(n,v,z,C,E,H){v||(v=3);z||(z=0);for(C=C?Math.min(C*v+z,n.length):n.length;z<C;z+=v)k[0]=n[z],k[1]=n[z+1],k[2]=n[z+2],E(k,k,H),n[z]=k[0],n[z+1]=k[1],n[z+2]=k[2];return n}}();kb=Object.freeze({__proto__:null,create:y,clone:function(k){var n=new sa(3);n[0]=k[0];n[1]=k[1];n[2]=k[2];return n},length:D,fromValues:G,copy:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];return k},set:function(k,
n,v,z){k[0]=n;k[1]=v;k[2]=z;return k},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];return k},subtract:A,multiply:F,divide:J,ceil:function(k,n){k[0]=Math.ceil(n[0]);k[1]=Math.ceil(n[1]);k[2]=Math.ceil(n[2]);return k},floor:function(k,n){k[0]=Math.floor(n[0]);k[1]=Math.floor(n[1]);k[2]=Math.floor(n[2]);return k},min:function(k,n,v){k[0]=Math.min(n[0],v[0]);k[1]=Math.min(n[1],v[1]);k[2]=Math.min(n[2],v[2]);return k},max:function(k,n,v){k[0]=Math.max(n[0],v[0]);k[1]=Math.max(n[1],
v[1]);k[2]=Math.max(n[2],v[2]);return k},round:function(k,n){k[0]=Math.round(n[0]);k[1]=Math.round(n[1]);k[2]=Math.round(n[2]);return k},scale:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;return k},scaleAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;return k},distance:B,squaredDistance:I,squaredLength:L,negate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];return k},inverse:function(k,n){k[0]=1/n[0];k[1]=1/n[1];k[2]=1/n[2];return k},normalize:Q,dot:S,cross:U,lerp:function(k,
n,v,z){var C=n[0],E=n[1];n=n[2];k[0]=C+z*(v[0]-C);k[1]=E+z*(v[1]-E);k[2]=n+z*(v[2]-n);return k},slerp:function(k,n,v,z){var C=Math.acos(Math.min(Math.max(S(n,v),-1),1)),E=Math.sin(C),H=Math.sin((1-z)*C)/E;z=Math.sin(z*C)/E;k[0]=H*n[0]+z*v[0];k[1]=H*n[1]+z*v[1];k[2]=H*n[2]+z*v[2];return k},hermite:function(k,n,v,z,C,E){var H=E*E,K=H*(2*E-3)+1,M=H*(E-2)+E,O=H*(E-1);E=H*(3-2*E);k[0]=n[0]*K+v[0]*M+z[0]*O+C[0]*E;k[1]=n[1]*K+v[1]*M+z[1]*O+C[1]*E;k[2]=n[2]*K+v[2]*M+z[2]*O+C[2]*E;return k},bezier:function(k,
n,v,z,C,E){var H=1-E,K=H*H,M=E*E,O=K*H;K*=3*E;H*=3*M;E*=M;k[0]=n[0]*O+v[0]*K+z[0]*H+C[0]*E;k[1]=n[1]*O+v[1]*K+z[1]*H+C[1]*E;k[2]=n[2]*O+v[2]*K+z[2]*H+C[2]*E;return k},random:function(k,n){n=n||1;var v=2*Sa()*Math.PI,z=2*Sa()-1,C=Math.sqrt(1-z*z)*n;k[0]=Math.cos(v)*C;k[1]=Math.sin(v)*C;k[2]=z*n;return k},transformMat4:function(k,n,v){var z=n[0],C=n[1];n=n[2];var E=v[3]*z+v[7]*C+v[11]*n+v[15];E=E||1;k[0]=(v[0]*z+v[4]*C+v[8]*n+v[12])/E;k[1]=(v[1]*z+v[5]*C+v[9]*n+v[13])/E;k[2]=(v[2]*z+v[6]*C+v[10]*n+
v[14])/E;return k},transformMat3:function(k,n,v){var z=n[0],C=n[1];n=n[2];k[0]=z*v[0]+C*v[3]+n*v[6];k[1]=z*v[1]+C*v[4]+n*v[7];k[2]=z*v[2]+C*v[5]+n*v[8];return k},transformQuat:function(k,n,v){var z=v[0],C=v[1],E=v[2],H=n[0],K=n[1];n=n[2];var M=C*n-E*K,O=E*H-z*n,R=z*K-C*H;v=2*v[3];k[0]=H+M*v+2*(C*R-E*O);k[1]=K+O*v+2*(E*M-z*R);k[2]=n+R*v+2*(z*O-C*M);return k},rotateX:function(k,n,v,z){var C=[],E=[];C[0]=n[0]-v[0];C[1]=n[1]-v[1];C[2]=n[2]-v[2];E[0]=C[0];E[1]=C[1]*Math.cos(z)-C[2]*Math.sin(z);E[2]=C[1]*
Math.sin(z)+C[2]*Math.cos(z);k[0]=E[0]+v[0];k[1]=E[1]+v[1];k[2]=E[2]+v[2];return k},rotateY:function(k,n,v,z){var C=[],E=[];C[0]=n[0]-v[0];C[1]=n[1]-v[1];C[2]=n[2]-v[2];E[0]=C[2]*Math.sin(z)+C[0]*Math.cos(z);E[1]=C[1];E[2]=C[2]*Math.cos(z)-C[0]*Math.sin(z);k[0]=E[0]+v[0];k[1]=E[1]+v[1];k[2]=E[2]+v[2];return k},rotateZ:function(k,n,v,z){var C=[],E=[];C[0]=n[0]-v[0];C[1]=n[1]-v[1];C[2]=n[2]-v[2];E[0]=C[0]*Math.cos(z)-C[1]*Math.sin(z);E[1]=C[0]*Math.sin(z)+C[1]*Math.cos(z);E[2]=C[2];k[0]=E[0]+v[0];k[1]=
E[1]+v[1];k[2]=E[2]+v[2];return k},angle:function(k,n){var v=k[0],z=k[1],C=k[2],E=n[0],H=n[1],K=n[2];k=(v=Math.sqrt((v*v+z*z+C*C)*(E*E+H*H+K*K)))&&S(k,n)/v;return Math.acos(Math.min(Math.max(k,-1),1))},zero:function(k){k[0]=0;k[1]=0;k[2]=0;return k},str:function(k){return"vec3("+k[0]+", "+k[1]+", "+k[2]+")"},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]},equals:function(k,n){var v=k[0],z=k[1];k=k[2];var C=n[0],E=n[1];n=n[2];return Math.abs(v-C)<=1E-6*Math.max(1,Math.abs(v),
Math.abs(C))&&Math.abs(z-E)<=1E-6*Math.max(1,Math.abs(z),Math.abs(E))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},sub:A,mul:F,div:J,dist:B,sqrDist:I,len:D,sqrLen:L,forEach:kb});var lb=function(){var k=V();return function(n,v,z,C,E,H){v||(v=4);z||(z=0);for(C=C?Math.min(C*v+z,n.length):n.length;z<C;z+=v)k[0]=n[z],k[1]=n[z+1],k[2]=n[z+2],k[3]=n[z+3],E(k,k,H),n[z]=k[0],n[z+1]=k[1],n[z+2]=k[2],n[z+3]=k[3];return n}}();lb=Object.freeze({__proto__:null,create:V,clone:Z,fromValues:ma,copy:va,
set:Na,add:Ea,subtract:Ia,multiply:Ma,divide:Fa,ceil:function(k,n){k[0]=Math.ceil(n[0]);k[1]=Math.ceil(n[1]);k[2]=Math.ceil(n[2]);k[3]=Math.ceil(n[3]);return k},floor:function(k,n){k[0]=Math.floor(n[0]);k[1]=Math.floor(n[1]);k[2]=Math.floor(n[2]);k[3]=Math.floor(n[3]);return k},min:function(k,n,v){k[0]=Math.min(n[0],v[0]);k[1]=Math.min(n[1],v[1]);k[2]=Math.min(n[2],v[2]);k[3]=Math.min(n[3],v[3]);return k},max:function(k,n,v){k[0]=Math.max(n[0],v[0]);k[1]=Math.max(n[1],v[1]);k[2]=Math.max(n[2],v[2]);
k[3]=Math.max(n[3],v[3]);return k},round:function(k,n){k[0]=Math.round(n[0]);k[1]=Math.round(n[1]);k[2]=Math.round(n[2]);k[3]=Math.round(n[3]);return k},scale:ya,scaleAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;k[2]=n[2]+v[2]*z;k[3]=n[3]+v[3]*z;return k},distance:na,squaredDistance:Va,length:xa,squaredLength:Ga,negate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];k[3]=-n[3];return k},inverse:function(k,n){k[0]=1/n[0];k[1]=1/n[1];k[2]=1/n[2];k[3]=1/n[3];return k},normalize:bb,dot:Xa,
cross:function(k,n,v,z){var C=v[0]*z[1]-v[1]*z[0],E=v[0]*z[2]-v[2]*z[0],H=v[0]*z[3]-v[3]*z[0],K=v[1]*z[2]-v[2]*z[1],M=v[1]*z[3]-v[3]*z[1];v=v[2]*z[3]-v[3]*z[2];z=n[0];var O=n[1],R=n[2];n=n[3];k[0]=O*v-R*M+n*K;k[1]=-(z*v)+R*H-n*E;k[2]=z*M-O*H+n*C;k[3]=-(z*K)+O*E-R*C;return k},lerp:ob,random:function(k,n){n=n||1;do{var v=2*Sa()-1;var z=2*Sa()-1;var C=v*v+z*z}while(1<=C);do{var E=2*Sa()-1;var H=2*Sa()-1;var K=E*E+H*H}while(1<=K);C=Math.sqrt((1-C)/K);k[0]=n*v;k[1]=n*z;k[2]=n*E*C;k[3]=n*H*C;return k},
transformMat4:function(k,n,v){var z=n[0],C=n[1],E=n[2];n=n[3];k[0]=v[0]*z+v[4]*C+v[8]*E+v[12]*n;k[1]=v[1]*z+v[5]*C+v[9]*E+v[13]*n;k[2]=v[2]*z+v[6]*C+v[10]*E+v[14]*n;k[3]=v[3]*z+v[7]*C+v[11]*E+v[15]*n;return k},transformQuat:function(k,n,v){var z=n[0],C=n[1],E=n[2],H=v[0],K=v[1],M=v[2];v=v[3];var O=v*z+K*E-M*C,R=v*C+M*z-H*E,T=v*E+H*C-K*z;z=-H*z-K*C-M*E;k[0]=O*v+z*-H+R*-M-T*-K;k[1]=R*v+z*-K+T*-H-O*-M;k[2]=T*v+z*-M+O*-K-R*-H;k[3]=n[3];return k},zero:function(k){k[0]=0;k[1]=0;k[2]=0;k[3]=0;return k},
str:function(k){return"vec4("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},exactEquals:pb,equals:function(k,n){var v=k[0],z=k[1],C=k[2];k=k[3];var E=n[0],H=n[1],K=n[2];n=n[3];return Math.abs(v-E)<=1E-6*Math.max(1,Math.abs(v),Math.abs(E))&&Math.abs(z-H)<=1E-6*Math.max(1,Math.abs(z),Math.abs(H))&&Math.abs(C-K)<=1E-6*Math.max(1,Math.abs(C),Math.abs(K))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},sub:Ia,mul:Ma,div:Fa,dist:na,sqrDist:Va,len:xa,sqrLen:Ga,forEach:lb});var mb=function(){var k=y(),
n=G(1,0,0),v=G(0,1,0);return function(z,C,E){var H=S(C,E);if(-.999999>H)return U(k,n,C),1E-6>D(k)&&U(k,v,C),Q(k,k),qb(z,k,Math.PI),z;if(.999999<H)return z[0]=0,z[1]=0,z[2]=0,z[3]=1,z;U(k,C,E);z[0]=k[0];z[1]=k[1];z[2]=k[2];z[3]=1+H;return bb(z,z)}}(),nb=function(){var k=cb(),n=cb();return function(v,z,C,E,H,K){db(k,z,H,K);db(n,C,E,K);db(v,k,n,2*K*(1-K));return v}}(),$a=function(){var k=f();return function(n,v,z,C){k[0]=z[0];k[3]=z[1];k[6]=z[2];k[1]=C[0];k[4]=C[1];k[7]=C[2];k[2]=-v[0];k[5]=-v[1];k[8]=
-v[2];return bb(n,xb(n,k))}}();mb=Object.freeze({__proto__:null,create:cb,identity:function(k){k[0]=0;k[1]=0;k[2]=0;k[3]=1;return k},setAxisAngle:qb,getAxisAngle:function(k,n){var v=2*Math.acos(n[3]),z=Math.sin(v/2);1E-6<z?(k[0]=n[0]/z,k[1]=n[1]/z,k[2]=n[2]/z):(k[0]=1,k[1]=0,k[2]=0);return v},getAngle:function(k,n){k=Xa(k,n);return Math.acos(2*k*k-1)},multiply:rb,rotateX:sb,rotateY:tb,rotateZ:ub,calculateW:function(k,n){var v=n[0],z=n[1];n=n[2];k[0]=v;k[1]=z;k[2]=n;k[3]=Math.sqrt(Math.abs(1-v*v-z*
z-n*n));return k},exp:vb,ln:wb,pow:function(k,n,v){wb(k,n);ya(k,k,v);vb(k,k);return k},slerp:db,random:function(k){var n=Sa(),v=Sa(),z=Sa(),C=Math.sqrt(1-n);n=Math.sqrt(n);k[0]=C*Math.sin(2*Math.PI*v);k[1]=C*Math.cos(2*Math.PI*v);k[2]=n*Math.sin(2*Math.PI*z);k[3]=n*Math.cos(2*Math.PI*z);return k},invert:function(k,n){var v=n[0],z=n[1],C=n[2];n=n[3];var E=v*v+z*z+C*C+n*n;E=E?1/E:0;k[0]=-v*E;k[1]=-z*E;k[2]=-C*E;k[3]=n*E;return k},conjugate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];k[3]=n[3];return k},
fromMat3:xb,fromEuler:function(k,n,v,z){var C=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"zyx",E=Math.PI/360;n*=E;z*=E;v*=E;E=Math.sin(n);var H=Math.cos(n),K=Math.sin(v),M=Math.cos(v),O=Math.sin(z),R=Math.cos(z);switch(C){case "xyz":k[0]=E*M*R+H*K*O;k[1]=H*K*R-E*M*O;k[2]=H*M*O+E*K*R;k[3]=H*M*R-E*K*O;break;case "xzy":k[0]=E*M*R-H*K*O;k[1]=H*K*R-E*M*O;k[2]=H*M*O+E*K*R;k[3]=H*M*R+E*K*O;break;case "yxz":k[0]=E*M*R+H*K*O;k[1]=H*K*R-E*M*O;k[2]=H*M*O-E*K*R;k[3]=H*M*R+E*K*O;break;case "yzx":k[0]=
E*M*R+H*K*O;k[1]=H*K*R+E*M*O;k[2]=H*M*O-E*K*R;k[3]=H*M*R-E*K*O;break;case "zxy":k[0]=E*M*R-H*K*O;k[1]=H*K*R+E*M*O;k[2]=H*M*O+E*K*R;k[3]=H*M*R-E*K*O;break;case "zyx":k[0]=E*M*R-H*K*O;k[1]=H*K*R+E*M*O;k[2]=H*M*O-E*K*R;k[3]=H*M*R+E*K*O;break;default:throw Error("Unknown angle order "+C);}return k},str:function(k){return"quat("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+")"},clone:Z,fromValues:ma,copy:va,set:Na,add:Ea,mul:rb,scale:ya,dot:Xa,lerp:ob,length:xa,len:xa,squaredLength:Ga,sqrLen:Ga,normalize:bb,exactEquals:pb,
equals:function(k,n){return.999999<=Math.abs(Xa(k,n))},rotationTo:mb,sqlerp:nb,setAxes:$a});nb=Object.freeze({__proto__:null,create:function(){var k=new sa(8);sa!=Float32Array&&(k[0]=0,k[1]=0,k[2]=0,k[4]=0,k[5]=0,k[6]=0,k[7]=0);k[3]=1;return k},clone:function(k){var n=new sa(8);n[0]=k[0];n[1]=k[1];n[2]=k[2];n[3]=k[3];n[4]=k[4];n[5]=k[5];n[6]=k[6];n[7]=k[7];return n},fromValues:function(k,n,v,z,C,E,H,K){var M=new sa(8);M[0]=k;M[1]=n;M[2]=v;M[3]=z;M[4]=C;M[5]=E;M[6]=H;M[7]=K;return M},fromRotationTranslationValues:function(k,
n,v,z,C,E,H){var K=new sa(8);K[0]=k;K[1]=n;K[2]=v;K[3]=z;C*=.5;E*=.5;H*=.5;K[4]=C*z+E*v-H*n;K[5]=E*z+H*k-C*v;K[6]=H*z+C*n-E*k;K[7]=-C*k-E*n-H*v;return K},fromRotationTranslation:yb,fromTranslation:function(k,n){k[0]=0;k[1]=0;k[2]=0;k[3]=1;k[4]=.5*n[0];k[5]=.5*n[1];k[6]=.5*n[2];k[7]=0;return k},fromRotation:function(k,n){k[0]=n[0];k[1]=n[1];k[2]=n[2];k[3]=n[3];k[4]=0;k[5]=0;k[6]=0;k[7]=0;return k},fromMat4:function(k,n){var v=cb();t(v,n);var z=new sa(3);w(z,n);yb(k,v,z);return k},copy:zb,identity:function(k){k[0]=
0;k[1]=0;k[2]=0;k[3]=1;k[4]=0;k[5]=0;k[6]=0;k[7]=0;return k},set:function(k,n,v,z,C,E,H,K,M){k[0]=n;k[1]=v;k[2]=z;k[3]=C;k[4]=E;k[5]=H;k[6]=K;k[7]=M;return k},getReal:va,getDual:function(k,n){k[0]=n[4];k[1]=n[5];k[2]=n[6];k[3]=n[7];return k},setReal:va,setDual:function(k,n){k[4]=n[0];k[5]=n[1];k[6]=n[2];k[7]=n[3];return k},getTranslation:function(k,n){var v=n[4],z=n[5],C=n[6],E=n[7],H=-n[0],K=-n[1],M=-n[2];n=n[3];k[0]=2*(v*n+E*H+z*M-C*K);k[1]=2*(z*n+E*K+C*H-v*M);k[2]=2*(C*n+E*M+v*K-z*H);return k},
translate:function(k,n,v){var z=n[0],C=n[1],E=n[2],H=n[3],K=.5*v[0],M=.5*v[1];v=.5*v[2];var O=n[4],R=n[5],T=n[6];n=n[7];k[0]=z;k[1]=C;k[2]=E;k[3]=H;k[4]=H*K+C*v-E*M+O;k[5]=H*M+E*K-z*v+R;k[6]=H*v+z*M-C*K+T;k[7]=-z*K-C*M-E*v+n;return k},rotateX:function(k,n,v){var z=-n[0],C=-n[1],E=-n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=K*H+R*z+M*E-O*C,Y=M*H+R*C+O*z-K*E,X=O*H+R*E+K*C-M*z;K=R*H-K*z-M*C-O*E;sb(k,n,v);z=k[0];C=k[1];E=k[2];H=k[3];k[4]=T*H+K*z+Y*E-X*C;k[5]=Y*H+K*C+X*z-T*E;k[6]=X*H+K*E+T*C-Y*z;k[7]=K*
H-T*z-Y*C-X*E;return k},rotateY:function(k,n,v){var z=-n[0],C=-n[1],E=-n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=K*H+R*z+M*E-O*C,Y=M*H+R*C+O*z-K*E,X=O*H+R*E+K*C-M*z;K=R*H-K*z-M*C-O*E;tb(k,n,v);z=k[0];C=k[1];E=k[2];H=k[3];k[4]=T*H+K*z+Y*E-X*C;k[5]=Y*H+K*C+X*z-T*E;k[6]=X*H+K*E+T*C-Y*z;k[7]=K*H-T*z-Y*C-X*E;return k},rotateZ:function(k,n,v){var z=-n[0],C=-n[1],E=-n[2],H=n[3],K=n[4],M=n[5],O=n[6],R=n[7],T=K*H+R*z+M*E-O*C,Y=M*H+R*C+O*z-K*E,X=O*H+R*E+K*C-M*z;K=R*H-K*z-M*C-O*E;ub(k,n,v);z=k[0];C=k[1];E=k[2];
H=k[3];k[4]=T*H+K*z+Y*E-X*C;k[5]=Y*H+K*C+X*z-T*E;k[6]=X*H+K*E+T*C-Y*z;k[7]=K*H-T*z-Y*C-X*E;return k},rotateByQuatAppend:function(k,n,v){var z=v[0],C=v[1],E=v[2];v=v[3];var H=n[0],K=n[1],M=n[2],O=n[3];k[0]=H*v+O*z+K*E-M*C;k[1]=K*v+O*C+M*z-H*E;k[2]=M*v+O*E+H*C-K*z;k[3]=O*v-H*z-K*C-M*E;H=n[4];K=n[5];M=n[6];O=n[7];k[4]=H*v+O*z+K*E-M*C;k[5]=K*v+O*C+M*z-H*E;k[6]=M*v+O*E+H*C-K*z;k[7]=O*v-H*z-K*C-M*E;return k},rotateByQuatPrepend:function(k,n,v){var z=n[0],C=n[1],E=n[2];n=n[3];var H=v[0],K=v[1],M=v[2],O=
v[3];k[0]=z*O+n*H+C*M-E*K;k[1]=C*O+n*K+E*H-z*M;k[2]=E*O+n*M+z*K-C*H;k[3]=n*O-z*H-C*K-E*M;H=v[4];K=v[5];M=v[6];O=v[7];k[4]=z*O+n*H+C*M-E*K;k[5]=C*O+n*K+E*H-z*M;k[6]=E*O+n*M+z*K-C*H;k[7]=n*O-z*H-C*K-E*M;return k},rotateAroundAxis:function(k,n,v,z){if(1E-6>Math.abs(z))return zb(k,n);var C=Math.hypot(v[0],v[1],v[2]);z*=.5;var E=Math.sin(z),H=E*v[0]/C,K=E*v[1]/C;v=E*v[2]/C;z=Math.cos(z);C=n[0];E=n[1];var M=n[2],O=n[3];k[0]=C*z+O*H+E*v-M*K;k[1]=E*z+O*K+M*H-C*v;k[2]=M*z+O*v+C*K-E*H;k[3]=O*z-C*H-E*K-M*v;
C=n[4];E=n[5];M=n[6];n=n[7];k[4]=C*z+n*H+E*v-M*K;k[5]=E*z+n*K+M*H-C*v;k[6]=M*z+n*v+C*K-E*H;k[7]=n*z-C*H-E*K-M*v;return k},add:function(k,n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];k[2]=n[2]+v[2];k[3]=n[3]+v[3];k[4]=n[4]+v[4];k[5]=n[5]+v[5];k[6]=n[6]+v[6];k[7]=n[7]+v[7];return k},multiply:eb,mul:eb,scale:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*v;k[2]=n[2]*v;k[3]=n[3]*v;k[4]=n[4]*v;k[5]=n[5]*v;k[6]=n[6]*v;k[7]=n[7]*v;return k},dot:Xa,lerp:function(k,n,v,z){var C=1-z;0>Xa(n,v)&&(z=-z);k[0]=n[0]*C+v[0]*z;k[1]=
n[1]*C+v[1]*z;k[2]=n[2]*C+v[2]*z;k[3]=n[3]*C+v[3]*z;k[4]=n[4]*C+v[4]*z;k[5]=n[5]*C+v[5]*z;k[6]=n[6]*C+v[6]*z;k[7]=n[7]*C+v[7]*z;return k},invert:function(k,n){var v=Ga(n);k[0]=-n[0]/v;k[1]=-n[1]/v;k[2]=-n[2]/v;k[3]=n[3]/v;k[4]=-n[4]/v;k[5]=-n[5]/v;k[6]=-n[6]/v;k[7]=n[7]/v;return k},conjugate:function(k,n){k[0]=-n[0];k[1]=-n[1];k[2]=-n[2];k[3]=n[3];k[4]=-n[4];k[5]=-n[5];k[6]=-n[6];k[7]=n[7];return k},length:xa,len:xa,squaredLength:Ga,sqrLen:Ga,normalize:function(k,n){var v=Ga(n);if(0<v){v=Math.sqrt(v);
var z=n[0]/v,C=n[1]/v,E=n[2]/v,H=n[3]/v,K=n[4],M=n[5],O=n[6];n=n[7];var R=z*K+C*M+E*O+H*n;k[0]=z;k[1]=C;k[2]=E;k[3]=H;k[4]=(K-z*R)/v;k[5]=(M-C*R)/v;k[6]=(O-E*R)/v;k[7]=(n-H*R)/v}return k},str:function(k){return"quat2("+k[0]+", "+k[1]+", "+k[2]+", "+k[3]+", "+k[4]+", "+k[5]+", "+k[6]+", "+k[7]+")"},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]&&k[2]===n[2]&&k[3]===n[3]&&k[4]===n[4]&&k[5]===n[5]&&k[6]===n[6]&&k[7]===n[7]},equals:function(k,n){var v=k[0],z=k[1],C=k[2],E=k[3],H=k[4],K=k[5],
M=k[6];k=k[7];var O=n[0],R=n[1],T=n[2],Y=n[3],X=n[4],fa=n[5],ha=n[6];n=n[7];return Math.abs(v-O)<=1E-6*Math.max(1,Math.abs(v),Math.abs(O))&&Math.abs(z-R)<=1E-6*Math.max(1,Math.abs(z),Math.abs(R))&&Math.abs(C-T)<=1E-6*Math.max(1,Math.abs(C),Math.abs(T))&&Math.abs(E-Y)<=1E-6*Math.max(1,Math.abs(E),Math.abs(Y))&&Math.abs(H-X)<=1E-6*Math.max(1,Math.abs(H),Math.abs(X))&&Math.abs(K-fa)<=1E-6*Math.max(1,Math.abs(K),Math.abs(fa))&&Math.abs(M-ha)<=1E-6*Math.max(1,Math.abs(M),Math.abs(ha))&&Math.abs(k-n)<=
1E-6*Math.max(1,Math.abs(k),Math.abs(n))}});$a=function(){var k=Wa();return function(n,v,z,C,E,H){v||(v=2);z||(z=0);for(C=C?Math.min(C*v+z,n.length):n.length;z<C;z+=v)k[0]=n[z],k[1]=n[z+1],E(k,k,H),n[z]=k[0],n[z+1]=k[1];return n}}();$a=Object.freeze({__proto__:null,create:Wa,clone:function(k){var n=new sa(2);n[0]=k[0];n[1]=k[1];return n},fromValues:function(k,n){var v=new sa(2);v[0]=k;v[1]=n;return v},copy:function(k,n){k[0]=n[0];k[1]=n[1];return k},set:function(k,n,v){k[0]=n;k[1]=v;return k},add:function(k,
n,v){k[0]=n[0]+v[0];k[1]=n[1]+v[1];return k},subtract:fb,multiply:gb,divide:Ya,ceil:function(k,n){k[0]=Math.ceil(n[0]);k[1]=Math.ceil(n[1]);return k},floor:function(k,n){k[0]=Math.floor(n[0]);k[1]=Math.floor(n[1]);return k},min:function(k,n,v){k[0]=Math.min(n[0],v[0]);k[1]=Math.min(n[1],v[1]);return k},max:function(k,n,v){k[0]=Math.max(n[0],v[0]);k[1]=Math.max(n[1],v[1]);return k},round:function(k,n){k[0]=Math.round(n[0]);k[1]=Math.round(n[1]);return k},scale:function(k,n,v){k[0]=n[0]*v;k[1]=n[1]*
v;return k},scaleAndAdd:function(k,n,v,z){k[0]=n[0]+v[0]*z;k[1]=n[1]+v[1]*z;return k},distance:hb,squaredDistance:Ta,length:ib,squaredLength:jb,negate:function(k,n){k[0]=-n[0];k[1]=-n[1];return k},inverse:function(k,n){k[0]=1/n[0];k[1]=1/n[1];return k},normalize:function(k,n){var v=n[0],z=n[1];v=v*v+z*z;0<v&&(v=1/Math.sqrt(v));k[0]=n[0]*v;k[1]=n[1]*v;return k},dot:function(k,n){return k[0]*n[0]+k[1]*n[1]},cross:function(k,n,v){n=n[0]*v[1]-n[1]*v[0];k[0]=k[1]=0;k[2]=n;return k},lerp:function(k,n,v,
z){var C=n[0];n=n[1];k[0]=C+z*(v[0]-C);k[1]=n+z*(v[1]-n);return k},random:function(k,n){n=n||1;var v=2*Sa()*Math.PI;k[0]=Math.cos(v)*n;k[1]=Math.sin(v)*n;return k},transformMat2:function(k,n,v){var z=n[0];n=n[1];k[0]=v[0]*z+v[2]*n;k[1]=v[1]*z+v[3]*n;return k},transformMat2d:function(k,n,v){var z=n[0];n=n[1];k[0]=v[0]*z+v[2]*n+v[4];k[1]=v[1]*z+v[3]*n+v[5];return k},transformMat3:function(k,n,v){var z=n[0];n=n[1];k[0]=v[0]*z+v[3]*n+v[6];k[1]=v[1]*z+v[4]*n+v[7];return k},transformMat4:function(k,n,v){var z=
n[0];n=n[1];k[0]=v[0]*z+v[4]*n+v[12];k[1]=v[1]*z+v[5]*n+v[13];return k},rotate:function(k,n,v,z){var C=n[0]-v[0];n=n[1]-v[1];var E=Math.sin(z);z=Math.cos(z);k[0]=C*z-n*E+v[0];k[1]=C*E+n*z+v[1];return k},angle:function(k,n){var v=k[0];k=k[1];var z=n[0];n=n[1];var C=Math.sqrt((v*v+k*k)*(z*z+n*n));return Math.acos(Math.min(Math.max(C&&(v*z+k*n)/C,-1),1))},zero:function(k){k[0]=0;k[1]=0;return k},str:function(k){return"vec2("+k[0]+", "+k[1]+")"},exactEquals:function(k,n){return k[0]===n[0]&&k[1]===n[1]},
equals:function(k,n){var v=k[0];k=k[1];var z=n[0];n=n[1];return Math.abs(v-z)<=1E-6*Math.max(1,Math.abs(v),Math.abs(z))&&Math.abs(k-n)<=1E-6*Math.max(1,Math.abs(k),Math.abs(n))},len:ib,sub:fb,mul:gb,div:Ya,dist:hb,sqrDist:Ta,sqrLen:jb,forEach:$a});e.glMatrix=Db;e.mat2=Eb;e.mat2d=Fb;e.mat3=Gb;e.mat4=Hb;e.quat=mb;e.quat2=nb;e.vec2=$a;e.vec3=kb;e.vec4=lb;Object.defineProperty(e,"__esModule",{value:!0})});
{"use strict";function e(B,I,L){var Q=[0,0];var S=B[1][1]-B[0][1];var U=B[0][0]-B[1][0];B=S*B[0][0]+U*B[0][1];var V=I[1][1]-I[0][1];var Z=I[0][0]-I[1][0];I=V*I[0][0]+Z*I[0][1];var ma=S*Z-V*U;F(ma,0,L||0)||(Q[0]=(Z*B-U*I)/ma,Q[1]=(S*I-V*B)/ma);return Q}function b(B,I,L,Q){var S=I[0]-B[0];I=I[1]-B[1];var U=Q[0]-L[0],V=Q[1]-L[1];if(0===U*I-V*S)return!1;Q=(S*(L[1]-B[1])+I*(B[0]-L[0]))/(U*I-V*S);B=(U*(B[1]-L[1])+V*(L[0]-B[0]))/(V*S-U*I);return 0<=Q&&1>=Q&&0<=B&&1>=B}function a(B,I,L){return(I[0]-B[0])*
(L[1]-B[1])-(L[0]-B[0])*(I[1]-B[1])}function d(B,I,L){return 0<a(B,I,L)}function c(B,I,L){return 0<=a(B,I,L)}function f(B,I,L){return 0>a(B,I,L)}function h(B,I,L){return 0>=a(B,I,L)}var tmpPoint1$$module$str$c3runtime=[],tmpPoint2$$module$str$c3runtime=[];function g(B,I,L,Q){if(Q){var S=tmpPoint1$$module$str$c3runtime,U=tmpPoint2$$module$str$c3runtime;S[0]=I[0]-B[0];S[1]=I[1]-B[1];U[0]=L[0]-I[0];U[1]=L[1]-I[1];return Math.acos((S[0]*U[0]+S[1]*U[1])/(Math.sqrt(S[0]*S[0]+S[1]*S[1])*Math.sqrt(U[0]*U[0]+
U[1]*U[1])))<Q}return 0===a(B,I,L)}function l(B,I){var L=I[0]-B[0];B=I[1]-B[1];return L*L+B*B}function m(B,I){var L=B.length;return B[0>I?I%L+L:I%L]}function u(B){B.length=0}function w(B,I,L,Q){for(;L<Q;L++)B.push(I[L])}function q(B){for(var I=[],L=B.length,Q=0;Q!==L;Q++)I.push(B.pop());for(Q=0;Q!==L;Q++)B[Q]=I[Q]}function t(B,I){return f(m(B,I-1),m(B,I),m(B,I+1))}var tmpLine1$$module$str$c3runtime=[],tmpLine2$$module$str$c3runtime=[];function p(B,I,L){var Q=tmpLine1$$module$str$c3runtime,S=tmpLine2$$module$str$c3runtime;
if(c(m(B,I+1),m(B,I),m(B,L))&&h(m(B,I-1),m(B,I),m(B,L)))return!1;var U=l(m(B,I),m(B,L));for(var V=0;V!==B.length;++V)if((V+1)%B.length!==I&&V!==I&&c(m(B,I),m(B,L),m(B,V+1))&&h(m(B,I),m(B,L),m(B,V))){Q[0]=m(B,I);Q[1]=m(B,L);S[0]=m(B,V);S[1]=m(B,V+1);var Z=e(Q,S);if(l(m(B,I),Z)<U)return!1}return!0}function r(B,I,L){for(var Q=0;Q!==B.length;++Q)if(Q!==I&&Q!==L&&(Q+1)%B.length!==I&&(Q+1)%B.length!==L&&b(m(B,I),m(B,L),m(B,Q),m(B,Q+1)))return!1;return!0}function x(B,I,L,Q){Q=Q||[];u(Q);if(I<L)for(var S=
I;S<=L;S++)Q.push(B[S]);else{for(S=0;S<=L;S++)Q.push(B[S]);for(S=I;S<B.length;S++)Q.push(B[S])}return Q}function y(B){for(var I=[],L,Q,S=[],U=Number.MAX_VALUE,V=0;V<B.length;++V)if(t(B,V))for(var Z=0;Z<B.length;++Z)if(p(B,V,Z)){L=y(x(B,V,Z,S));Q=y(x(B,Z,V,S));for(var ma=0;ma<Q.length;ma++)L.push(Q[ma]);L.length<U&&(I=L,U=L.length,I.push([m(B,V),m(B,Z)]))}return I}function D(B,I){if(0===I.length)return[B];if(I instanceof Array&&I.length&&I[0]instanceof Array&&2===I[0].length&&I[0][0]instanceof Array){B=
[B];for(var L=0;L<I.length;L++)for(var Q=I[L],S=0;S<B.length;S++){var U=D(B[S],Q);if(U){B.splice(S,1);B.push(U[0],U[1]);break}}return B}Q=I;L=B.indexOf(Q[0]);S=B.indexOf(Q[1]);return-1!==L&&-1!==S?[x(B,L,S),x(B,S,L)]:!1}function G(B,I,L,Q,S){var U=I[1]-B[1];I=B[0]-I[0];B=U*B[0]+I*B[1];var V=Q[1]-L[1];Q=L[0]-Q[0];L=V*L[0]+Q*L[1];var Z=U*Q-V*I;return F(Z,0,S||0)?[0,0]:[(Q*B-I*L)/Z,(U*L-V*B)/Z]}function A(B,I,L,Q,S,U,V){U=U||100;V=V||0;S=S||25;I="undefined"!==typeof I?I:[];L=L||[];Q=Q||[];var Z=[0,0],
ma=[0,0],va=[0,0],Na,Ea=0,Ia=0,Ma=0,Fa=[],ya=[];if(3>B.length)return I;V++;if(V>U)return console.warn("quickDecomp: max level ("+U+") reached."),I;for(var na=0;na<B.length;++na)if(t(B,na)){L.push(B[na]);var Va=Na=Number.MAX_VALUE;for(var xa=0;xa<B.length;++xa){if(d(m(B,na-1),m(B,na),m(B,xa))&&h(m(B,na-1),m(B,na),m(B,xa-1))&&(va=G(m(B,na-1),m(B,na),m(B,xa),m(B,xa-1)),f(m(B,na+1),m(B,na),va))){var Ga=l(B[na],va);Ga<Na&&(Na=Ga,ma=va,Ia=xa)}d(m(B,na+1),m(B,na),m(B,xa+1))&&h(m(B,na+1),m(B,na),m(B,xa))&&
(va=G(m(B,na+1),m(B,na),m(B,xa),m(B,xa+1)),d(m(B,na-1),m(B,na),va)&&(Ga=l(B[na],va),Ga<Va&&(Va=Ga,Z=va,Ea=xa)))}if(Ia===(Ea+1)%B.length)va[0]=(ma[0]+Z[0])/2,va[1]=(ma[1]+Z[1])/2,Q.push(va),na<Ea?(w(Fa,B,na,Ea+1),Fa.push(va),ya.push(va),0!==Ia&&w(ya,B,Ia,B.length),w(ya,B,0,na+1)):(0!==na&&w(Fa,B,na,B.length),w(Fa,B,0,Ea+1),Fa.push(va),ya.push(va),w(ya,B,Ia,na+1));else{Ia>Ea&&(Ea+=B.length);Z=Number.MAX_VALUE;if(Ea<Ia)return I;for(xa=Ia;xa<=Ea;++xa)c(m(B,na-1),m(B,na),m(B,xa))&&h(m(B,na+1),m(B,na),
m(B,xa))&&(Ga=l(m(B,na),m(B,xa)),Ga<Z&&r(B,na,xa)&&(Z=Ga,Ma=xa%B.length));na<Ma?(w(Fa,B,na,Ma+1),0!==Ma&&w(ya,B,Ma,B.length),w(ya,B,0,na+1)):(0!==na&&w(Fa,B,na,B.length),w(Fa,B,0,Ma+1),w(ya,B,Ma,na+1))}Fa.length<ya.length?(A(Fa,I,L,Q,S,U,V),A(ya,I,L,Q,S,U,V)):(A(ya,I,L,Q,S,U,V),A(Fa,I,L,Q,S,U,V));return I}I.push(B);return I}function F(B,I,L){return Math.abs(B-I)<=(L||0)}function J(B,I,L){return F(B[0],I[0],L)&&F(B[1],I[1],L)}self.polyDecomp={decomp:function(B){var I=y(B);return 0<I.length?D(B,I):
[B]},quickDecomp:A,isSimple:function(B){var I;for(I=0;I<B.length-1;I++)for(var L=0;L<I-1;L++)if(b(B[I],B[I+1],B[L],B[L+1]))return!1;for(I=1;I<B.length-2;I++)if(b(B[0],B[B.length-1],B[I],B[I+1]))return!1;return!0},removeCollinearPoints:function(B,I){for(var L=0,Q=B.length-1;3<B.length&&0<=Q;--Q)g(m(B,Q-1),m(B,Q),m(B,Q+1),I)&&(B.splice(Q%B.length,1),L++);return L},removeDuplicatePoints:function(B,I){for(var L=B.length-1;1<=L;--L)for(var Q=B[L],S=L-1;0<=S;--S)J(Q,B[S],I)&&B.splice(L,1)},makeCCW:function(B){for(var I=
0,L=1;L<B.length;++L)if(B[L][1]<B[I][1]||B[L][1]===B[I][1]&&B[L][0]>B[I][0])I=L;if(d(m(B,I-1),m(B,I),m(B,I+1)))return!1;q(B);return!0}}}
{"use strict";let e=!1,b=!1,a="dev";const d=self.C3=class{constructor(){throw TypeError("static class can't be instantiated");}static SetReady(){e=!0}static IsReady(){return e}static SetAppStarted(){b=!0}static HasAppStarted(){return b}static SetBuildMode(c){a=c}static GetBuildMode(){return a}static IsReleaseBuild(){return"final"===a}};d.isDebug=!1;d.isDebugDefend=!1;d.hardwareConcurrency=navigator.hardwareConcurrency||2;self.C3X={}}
{"use strict";const e=self.C3;e.QueryParser=class{constructor(b){this._queryString=b;this._parameters=new Map;this._Parse()}_Parse(){var b=this._queryString;if(b.startsWith("?")||b.startsWith("#"))b=b.substr(1);b=b.split("&");for(const a of b)this._ParseParameter(a)}_ParseParameter(b){if(b)if(b.includes("=")){var a=b.indexOf("="),d=decodeURIComponent(b.substring(0,a));b=decodeURIComponent(b.substring(a+1));this._parameters.set(d,b)}else this._parameters.set(b,null)}LogAll(){for(const b of this._parameters)console.log("[QueryParser] Parameter '"+
b[0]+"' = "+(null===b[1]?"null":"'"+b[1]+"'"))}Has(b){return this._parameters.has(b)}Get(b){b=this._parameters.get(b);return"undefined"===typeof b?null:b}ClearHash(){history.replaceState("",document.title,location.pathname+location.search)}Reparse(b){this._queryString=b;this._parameters.clear();this._Parse()}};e.QueryString=new e.QueryParser(location.search);e.LocationHashString=new e.QueryParser(location.hash);"dev"!==e.QueryString.Get("mode")&&e.SetBuildMode("final")}
{"use strict";const e=self.C3,b=navigator.userAgent;let a={linux:/linux|openbsd|freebsd|netbsd/i.test(b),chromeOS:/CrOS/.test(b),windowsTizen:/trident|iemobile|msie|tizen/i.test(b),genericMS:/trident|iemobile|msie|edge\//i.test(b),opera:/OPR\//.test(b),blackberry:/bb10/i.test(b),edge:/edge\//i.test(b),trident:/trident/i.test(b),webkit:/webkit/i.test(b),safari:/safari\//i.test(b),chrome:/chrome\//i.test(b),chromium:/chromium\//i.test(b),crosswalk:/crosswalk|xwalk/i.test(b),nwjs:/nwjs/i.test(b),amazonwebapp:/amazonwebappplatform/i.test(b),
webview:/wv\)/.test(b),android:/android/i.test(b),nokia:/nokiabrowser\/[0-9.]+/i.test(b)};var JSCompiler_object_inline_windows_0=/windows\s+nt\s+\d+\.\d+/i.exec(b),JSCompiler_object_inline_OSX_1=/mac\s+os\s+x\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_android_2=/android\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_opera_3=/OPR\/[0-9.]+/.exec(b),JSCompiler_object_inline_tizen_4=/tizen\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_iphone_5=/iphone\s+os\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_ipad_6=
/ipad[^)]*os\s+[0-9_]+/i.exec(b),JSCompiler_object_inline_winPhone_7=/windows\s+phone\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_winPhoneOS_8=/windows\s+phone\s+os\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_chrome_9=/chrome\/[0-9.]+/i.exec(b),JSCompiler_object_inline_chromium_10=/chromium\/[0-9.]+/i.exec(b),JSCompiler_object_inline_nwjs_11=/nwjs\/[0-9.]+/i.exec(b),JSCompiler_object_inline_firefox_12=/firefox\/[0-9.]+/i.exec(b),JSCompiler_object_inline_ie_13=/msie\s+[0-9.]+/i.exec(b),JSCompiler_object_inline_edge_14=
/edge\/[0-9.]+/i.exec(b),JSCompiler_object_inline_edgeChromium_15=/edg\/[0-9.]+/i.exec(b),JSCompiler_object_inline_silk_16=/silk\/[0-9.]+/i.exec(b);let d="(unknown)",c="(unknown)",f="(unknown)",h="(unknown)",g="(unknown)",l="browser",m=!1,u=!1,w=new Map;function q(p,r,x){!0===r?(x(),w.set(p,!0)):r&&r.length&&(x(r[0]),w.set(p,!0))}q("isWindows",JSCompiler_object_inline_windows_0,p=>{d="Windows";if(p=p.split(" ")[2])switch(p){case "5.0":c="2000";break;case "5.1":c="XP";break;case "5.2":c="XP";break;
case "6.0":c="Vista";break;case "6.1":c="7";break;case "6.2":c="8";break;case "6.3":c="8.1";break;case "10.0":c="10"}});q("isOSX",JSCompiler_object_inline_OSX_1,p=>{d="Mac OS X";(p=p.split(" ")[3])&&(c=p.replace("_","."))});q("isLinux",a.linux,()=>{d="Linux"});q("isChromeOS",a.chromeOS,()=>{d="Chrome OS"});q("isAndroid",!a.windowsTizen&&JSCompiler_object_inline_android_2,p=>{d="Android";(p=p.split(" ")[1])&&(c=p)});q("isTizen",JSCompiler_object_inline_tizen_4,p=>{d="Tizen";(p=p.split(" ")[1])&&(c=
p)});q("isIPhone",!a.windowsTizen&&JSCompiler_object_inline_iphone_5,p=>{d="iOS";(p=p.split(" ")[2])&&(c=p.replace("_","."))});q("isIPad",!a.windowsTizen&&JSCompiler_object_inline_ipad_6,p=>{d="iOS";(p=p.split(" ")[3])&&(c=p.replace("_","."))});q("isWindowsPhone",JSCompiler_object_inline_winPhone_7,p=>{d="Windows Phone";(p=p.split(" ")[2])&&(c=p)});q("isWindowsPhoneOS",JSCompiler_object_inline_winPhoneOS_8,p=>{d="Windows Phone";(p=p.split(" ")[3])&&(c=p)});q("isBlackberry",a.blackberry,()=>{d="Blackberry";
c="10";f="stock";g="webkit"});q("isChrome",!a.edge&&!a.opera&&JSCompiler_object_inline_chrome_9,p=>{f="Chrome";g="Chromium";(p=p.split("/")[1])&&(h=p)});q("isOpera",JSCompiler_object_inline_opera_3,p=>{f="Opera";g="Chromium";(p=p.split("/")[1])&&(h=p)});q("isChromium",JSCompiler_object_inline_chromium_10,p=>{g=f="Chromium";(p=p.split("/")[1])&&(h=p)});q("isFirefox",JSCompiler_object_inline_firefox_12,p=>{f="Firefox";g="Gecko";(p=p.split("/")[1])&&(h=p)});q("isInternetExplorer",JSCompiler_object_inline_ie_13,
p=>{f="Internet Explorer";g="Trident";(p=p.split(" ")[1])&&(h=p)});q("isTrident","Internet Explorer"!==f&&a.trident,()=>{g="Trident";var p=/rv:[0-9.]+/i.exec(b);p&&p.length&&(f="Internet Explorer",(p=p[0].split(":")[1])&&(h=p))});q("isEdge",JSCompiler_object_inline_edge_14,p=>{g=f="Edge";(p=p.split("/")[1])&&(h=p)});q("isEdgeChromium",JSCompiler_object_inline_edgeChromium_15,p=>{f="Edge";g="Chromium";(p=p.split("/")[1])&&(h=p)});q("isSafari",a.safari&&!a.nokia&&!a.chrome&&!a.chromium&&!a.genericIE&&
!a.blackberry,()=>{f="Safari";g="WebKit";var p=/version\/[0-9.]+/i.exec(b),r=/crios\/[0-9.]+/i.exec(b),x=/fxios\/[0-9.]+/i.exec(b);p&&p.length&&(p=p[0].split("/")[1])&&(h=p);r&&r.length&&(f="Chrome for iOS",(r=r[0].split("/")[1])&&(h=r));x&&x.length&&(f="Firefox for iOS",(x=x[0].split("/")[1])&&(h=x))});q("isSilk",JSCompiler_object_inline_silk_16,p=>{f="Silk";(p=p.split("/")[1])&&(h=p)});q("isCrosswalk",a.crosswalk,()=>l="crosswalk");q("isCordova",self.device&&(self.device.cordova||self.device.phonegap),
()=>l="cordova");q("isNWJS",JSCompiler_object_inline_nwjs_11,p=>{l="nwjs";f="NW.js";g="Chromium";(p=p.split("/")[1])&&(h=p)});q("isAmazonWebApp",a.amazonwebapp,()=>l="webapp");q("isHomeScreenWebApp","nwjs"!==l&&"undefined"!==typeof window&&(window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches||navigator.standalone),()=>l="webapp");q("isFalseSafari","Safari"===f&&("Android"===d||"Tizen"===d||"Blackberry"===d),()=>f="stock");q("isAndroidWebview","Chrome"===f&&"browser"===l&&a.webview,
()=>l="webview");q("isFirefoxOS","Firefox"===f&&"(unknown)"===d,()=>d="Firefox OS");q("isAndroidFallback","(unknown)"===d&&!a.windowsTizen&&a.android,()=>d="Android");q("isTridentFallback","(unknown)"===d&&a.trident,()=>g="Trident");q("isWebkitFallback","(unknown)"===d&&a.webkit,()=>g="WebKit");q("isDesktop",(()=>"Windows"===d||"Mac OS X"===d||"Linux"===d||"Chrome OS"===d||"nwjs"===l)(),()=>m=!0);u="nwjs"===l;const t="Mac OS X"===d&&navigator.maxTouchPoints&&2<navigator.maxTouchPoints;t&&(d="iOS",
c=h,u=m=!1);e.Platform={OS:d,OSVersion:c,Browser:f,BrowserVersion:h,BrowserVersionNumber:parseFloat(h),BrowserEngine:g,Context:l,IsDesktop:m,IsMobile:!m,IsDesktopApp:u,IsChromeWebStore:!!(self.chrome&&self.chrome.runtime&&self.chrome.runtime.id),IsAppleOS:"Mac OS X"===d||"iOS"===d,IsIpadOS:t,IsLinux:"Linux"===d}}"use strict";
{const e=new Map,b="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAll,a="undefined"!==typeof IDBObjectStore&&"function"===typeof IDBObjectStore.prototype.getAllKeys;function d(t){return new Promise((p,r)=>{t.onsuccess=()=>p(t.result);t.onerror=()=>r(t.error)})}function c(t){return new Promise((p,r)=>{t.oncomplete=()=>p();t.onerror=()=>r(t.error);t.onabort=()=>r(t.error)})}function f(t,p){return g(t,p)}function h(t,p){return g(t,p,!0)}async function g(t,p,r=!1,
x=!0){const y=await l(t);try{const D=y.transaction(["keyvaluepairs"],r?"readwrite":"readonly");return p(D)}catch(D){if(x&&"InvalidStateError"===D.name)return e.delete(t),g(t,p,r,!1);throw D;}}function l(t){u(t);let p=e.get(t);p instanceof Promise||(p=m(t),e.set(t,p),p.catch(r=>e.delete(t)));return p}async function m(t){u(t);const p=indexedDB.open(t,2);p.addEventListener("upgradeneeded",r=>{try{r.target.result.createObjectStore("keyvaluepairs")}catch(x){console.error(`Failed to create objectstore for database ${t}`,
x)}});return d(p)}function u(t){if("string"!==typeof t)throw new TypeError("expected string");}function w(t,p){const r=t.objectStore("keyvaluepairs").openCursor();return new Promise(x=>{const y=[];r.onsuccess=D=>{if(D=D.target.result){switch(p){case "entries":y.push([D.key,D.value]);break;case "keys":y.push(D.key);break;case "values":y.push(D.value)}D.continue()}else x(y)}})}class q{constructor(t){u(t);this.name=t}async ready(){await l(this.name)}set(t,p){u(t);return h(this.name,async r=>{var x=r.objectStore("keyvaluepairs").put(p,
t);x=d(x);r=c(r);await Promise.all([r,x])})}get(t){u(t);return f(this.name,async p=>{var r=p.objectStore("keyvaluepairs").get(t);r=d(r);p=c(p);[,p]=await Promise.all([p,r]);return p})}delete(t){u(t);return h(this.name,async p=>{var r=p.objectStore("keyvaluepairs").delete(t);r=d(r);p=c(p);await Promise.all([p,r])})}clear(){return h(this.name,async t=>{var p=t.objectStore("keyvaluepairs").clear();p=d(p);t=c(t);await Promise.all([t,p])})}keys(){return f(this.name,async t=>{if(a){var p=t.objectStore("keyvaluepairs").getAllKeys();
p=d(p)}else p=w(t,"keys");t=c(t);[,t]=await Promise.all([t,p]);return t})}values(){return f(this.name,async t=>{if(b){var p=t.objectStore("keyvaluepairs").getAll();p=d(p)}else p=w(t,"values");t=c(t);[,t]=await Promise.all([t,p]);return t})}entries(){return f(this.name,async t=>{var p=w(t,"entries");t=c(t);[,p]=await Promise.all([t,p]);return p})}}self.KVStorageContainer=q}"use strict";
{const e=self.KVStorageContainer,b=[/no available storage method found/i,/an attempt was made to break through the security policy of the user agent/i,/the user denied permission to access the database/i,/a mutation operation was attempted on a database that did not allow mutations/i,/idbfactory\.open\(\) called in an invalid security context/i],a=new WeakMap;let d=!1;"undefined"===typeof indexedDB&&(d=!0,console.warn("Unable to use local storage because indexedDB is not defined"));function c(l){throw Error(`"${l}" is not implemented`);
}function f(l){if("function"===typeof l)throw Error("localforage callback API is not implemented; please use the promise API instead");}function h(l){return"object"===typeof l?new Promise(m=>{const {port1:u,port2:w}=new MessageChannel;w.onmessage=q=>m(q.data);u.postMessage(l)}):Promise.resolve(l)}class g{constructor(l){this._inst=l;a.set(this,new Map)}_MaybeSwitchToMemoryFallback(l){if(!d)for(const m of b)if(l&&m.test(l.message)){console.error("Unable to use local storage, reverting to in-memory store: ",
l,l.message);d=!0;break}}async _getItemFallback(l){l=a.get(this).get(l);l=await h(l);return"undefined"===typeof l?null:l}async _setItemFallback(l,m){m=await h(m);a.get(this).set(l,m)}_removeItemFallback(l){a.get(this).delete(l)}_clearFallback(){a.get(this).clear()}_keysFallback(){return Array.from(a.get(this).keys())}IsUsingFallback(){return d}async getItem(l,m){f(m);if(d)return await this._getItemFallback(l);let u;try{u=await this._inst.get(l)}catch(w){this._MaybeSwitchToMemoryFallback(w);if(d)return await this._getItemFallback(l);
console.error(`Error reading '${l}' from storage, returning null: `,w);return null}return"undefined"===typeof u?null:u}async setItem(l,m,u){f(u);"undefined"===typeof m&&(m=null);if(d)await this._setItemFallback(l,m);else try{await this._inst.set(l,m)}catch(w){if(this._MaybeSwitchToMemoryFallback(w),d)await this._setItemFallback(l,m);else throw w;}}async removeItem(l,m){f(m);if(d)this._removeItemFallback(l);else try{await this._inst.delete(l)}catch(u){this._MaybeSwitchToMemoryFallback(u),d?this._removeItemFallback(l):
console.error(`Error removing '${l}' from storage: `,u)}}async clear(l){f(l);if(d)this._clearFallback();else try{await this._inst.clear()}catch(m){this._MaybeSwitchToMemoryFallback(m),d?this._clearFallback():console.error("Error clearing storage: ",m)}}async keys(l){f(l);if(d)return this._keysFallback();l=[];try{l=await this._inst.keys()}catch(m){this._MaybeSwitchToMemoryFallback(m);if(d)return this._keysFallback();console.error("Error getting storage keys: ",m)}return l}ready(l){f(l);return d?Promise.resolve(!0):
this._inst.ready()}createInstance(l){if("object"!==typeof l)throw new TypeError("invalid options object");l=l.name;if("string"!==typeof l)throw new TypeError("invalid store name");l=new e(l);return new g(l)}length(l){c("localforage.length()")}key(l,m){c("localforage.key()")}iterate(l,m){c("localforage.iterate()")}setDriver(l){c("localforage.setDriver()")}config(l){c("localforage.config()")}defineDriver(l){c("localforage.defineDriver()")}driver(){c("localforage.driver()")}supports(l){c("localforage.supports()")}dropInstance(){c("localforage.dropInstance()")}disableMemoryMode(){d=
!1}}self.localforage=new g(new e("localforage"))}
{"use strict";const e=self.C3;e.Supports={};e.Supports.WebAnimations=(()=>{try{if("Safari"===e.Platform.Browser||"undefined"===typeof document)return!1;const b=document.createElement("div");return"undefined"===typeof b.animate?!1:"undefined"!==typeof b.animate([{opacity:"0"},{opacity:"1"}],1E3).reverse}catch(b){return!1}})();e.Supports.DialogElement="undefined"!==typeof HTMLDialogElement;e.Supports.RequestIdleCallback=!!self.requestIdleCallback;e.Supports.ImageBitmap=!!self.createImageBitmap&&"Safari"!==
e.Platform.Browser;e.Supports.ImageBitmapOptions=!1;e.Supports.ImageBitmapOptionsResize=!1;if(e.Supports.ImageBitmap){try{self.createImageBitmap(new ImageData(32,32),{premultiplyAlpha:"none"}).then(()=>{e.Supports.ImageBitmapOptions=!0}).catch(()=>{e.Supports.ImageBitmapOptions=!1})}catch(b){e.Supports.ImageBitmapOptions=!1}try{self.createImageBitmap(new ImageData(32,32),{resizeWidth:10,resizeHeight:10}).then(b=>{e.Supports.ImageBitmapOptionsResize=10===b.width&&10===b.height}).catch(()=>{e.Supports.ImageBitmapOptionsResize=
!1})}catch(b){e.Supports.ImageBitmapOptionsResize=!1}}e.Supports.ClipboardReadText=!(!navigator.clipboard||!navigator.clipboard.readText||"Firefox"===e.Platform.Browser);e.Supports.PermissionsQuery=!(!navigator.permissions||!navigator.permissions.query);e.Supports.Proxies="undefined"!==typeof Proxy;e.Supports.DownloadAttribute=(()=>"undefined"===typeof document?!1:"undefined"!==typeof document.createElement("a").download)();e.Supports.CanvasToBlob=(()=>"undefined"!==typeof HTMLCanvasElement&&HTMLCanvasElement.prototype.toBlob)();
e.Supports.Fetch="function"===typeof fetch;e.Supports.PersistentStorage=!!(self.isSecureContext&&"Opera"!==e.Platform.Browser&&navigator.storage&&navigator.storage.persist);e.Supports.StorageQuotaEstimate=!!(self.isSecureContext&&navigator.storage&&navigator.storage.estimate);e.Supports.Fullscreen=(()=>{if("undefined"===typeof document||"iOS"===e.Platform.OS)return!1;const b=document.documentElement;return!!(b.requestFullscreen||b.msRequestFullscreen||b.mozRequestFullScreen||b.webkitRequestFullscreen)})();
e.Supports.ImageDecoder="undefined"!==typeof self.ImageDecoder;e.Supports.WebCodecs=!!self.VideoEncoder;e.Supports.NativeFileSystemAPI=!!self.showOpenFilePicker;e.Supports.NavigatorFontsQuery=!(!navigator.fonts||!navigator.fonts.query);e.Supports.UserActivation=!!navigator.userActivation}
{"use strict";const e=self.C3;if(!String.prototype.trimStart){const b=/^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*/;String.prototype.trimStart=function(){return this.replace(b,"")}}if(!String.prototype.trimEnd){const b=/[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*$/;String.prototype.trimEnd=function(){return this.replace(b,
"")}}String.prototype.replaceAll||(String.prototype.replaceAll=function(b,a){return this.replace(new RegExp(e.EscapeRegex(b),"g"),a)});Array.prototype.values||(Array.prototype.values=function*(){for(const b of this)yield b});if(!Array.prototype.flat){function b(a,d){return a.reduce((c,f)=>{0<d&&Array.isArray(f)?Array.prototype.push.apply(c,b(f,d-1)):c.push(f);return c},[])}Array.prototype.flat=function(a=1){return b(this,a)}}Array.prototype.at||(Array.prototype.at=function(b){b=Math.trunc(b)||0;0>
b&&(b+=this.length);if(!(0>b||b>=this.length))return this[b]});String.prototype.at||(String.prototype.at=function(b){b=Math.trunc(b)||0;0>b&&(b+=this.length);if(!(0>b||b>=this.length))return this[b]});RegExp.escape||(RegExp.escape=function(b){return String(b).replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")});navigator.storage&&!navigator.storage.estimate&&navigator.webkitTemporaryStorage&&navigator.webkitTemporaryStorage.queryUsageAndQuota&&(navigator.storage.estimate=function(){return new Promise((b,a)=>navigator.webkitTemporaryStorage.queryUsageAndQuota((d,
c)=>b({usage:d,quota:c}),a))});"undefined"===typeof self.isSecureContext&&(self.isSecureContext="https:"===location.protocol);"undefined"===typeof self.globalThis&&(self.globalThis=self)}{"use strict";const e=self.C3;function b(a){let d=e.GetCallStack();console.error("Assertion failure: "+a+"\n\nStack trace:\n"+d)}self.assert=function(a,d){a||b(d)}}
{"use strict";const e=self.C3,b=self.C3X;e.IsNumber=function(d){return"number"===typeof d};e.IsFiniteNumber=function(d){return e.IsNumber(d)&&isFinite(d)};e.RequireNumber=function(d){if(!e.IsNumber(d))throw new TypeError("expected number");};e.RequireOptionalNumber=function(d){e.IsNullOrUndefined(d)};e.RequireNumberInRange=function(d,c,f){if(!e.IsNumber(d)||isNaN(d)||c>d||f<d)throw new RangeError("number outside of range");};e.RequireAllNumber=function(...d){for(let c of d);};e.RequireFiniteNumber=
function(d){if(!e.IsFiniteNumber(d))throw new TypeError("expected finite number");};e.RequireOptionalFiniteNumber=function(d){e.IsNullOrUndefined(d)};e.RequireAllFiniteNumber=function(...d){for(let c of d);};e.IsString=function(d){return"string"===typeof d};e.RequireString=function(d){if(!e.IsString(d))throw new TypeError("expected string");};e.RequireOptionalString=function(d){e.IsNullOrUndefined(d)};e.RequireAllString=function(...d){for(let c of d);};e.IsSimpleObject=function(d){return"object"!==
typeof d||null===d?!1:(d=Object.getPrototypeOf(d))?d.constructor===Object:null===d};e.RequireSimpleObject=function(d){if(!e.IsSimpleObject(d))throw new TypeError("expected simple object");};e.RequireOptionalSimpleObject=function(d){if(!e.IsNullOrUndefined(d)&&!e.IsSimpleObject(d))throw new TypeError("expected simple object");};e.IsObject=function(d){return"object"===typeof d&&null!==d&&!Array.isArray(d)};e.RequireObject=function(d){if(!e.IsObject(d))throw new TypeError("expected object");};e.RequireOptionalObject=
function(d){e.IsNullOrUndefined(d)};e.RequireAllObject=function(...d){for(let c of d);};e.IsFileLike=function(d){return e.IsInstanceOf(d,Blob)&&"string"===typeof d.name};e.RequireFileLike=function(d){if(!e.IsFileLike(d))throw new TypeError("expected file");};e.RequireOptionalFileLike=function(d){e.IsNullOrUndefined(d)};e.IsArray=function(d){return Array.isArray(d)};e.RequireArray=function(d){if(!e.IsArray(d))throw new TypeError("expected array");};e.RequireOptionalArray=function(d){e.IsNullOrUndefined(d)};
e.RequireAllArray=function(...d){for(let c of d);};e.Is2DArray=function(d){return e.IsArray(d)?d.length?e.IsArray(d[0])?!0:!1:!0:!1};e.Require2DArray=function(d){if(!e.Is2DArray(d))throw new TypeError("expected 2d array");for(let c of d)if(!e.IsArray(c))throw new TypeError("expected 2d array");};e.RequireOptional2DArray=function(d){e.IsNullOrUndefined(d)};e.IsFunction=function(d){return"function"===typeof d};e.RequireFunction=function(d,c){if(!e.IsFunction(d))throw new TypeError("expected function");
if(!e.IsNullOrUndefined(c)&&d!==c)throw new TypeError("expected same function reference");};e.RequireOptionalFunction=function(d){e.IsNullOrUndefined(d)};e.RequireAllFunction=function(...d){for(let c of d);};e.RequireAnyFunction=function(d,...c){if(!e.IsFunction(d))throw new TypeError("expected function");if(!c.length)throw Error("missing comparison functions");for(let f of c)if(!e.IsNullOrUndefined(f)&&d===f)return;throw new TypeError("expected same function reference");};e.RequireOptionalAllFunction=
function(...d){if(!e.IsNullOrUndefined(d))for(let c of d);};e.IsInstanceOf=function(d,c){return d instanceof c};e.IsInstanceOfAny=function(d,...c){for(let f of c)if(e.IsInstanceOf(d,f))return!0;return!1};e.RequireInstanceOf=function(d,c){if(!e.IsInstanceOf(d,c))throw new TypeError("unexpected type");};e.RequireOptionalInstanceOf=function(d,c){e.IsNullOrUndefined(d)};e.RequireAllInstanceOf=function(d,...c){for(let f of c);};e.RequireAnyInstanceOf=function(d,...c){if(!e.IsInstanceOfAny(d,...c))throw new TypeError("unexpected type");
};e.RequireAnyOptionalInstanceOf=function(d,...c){if(!e.IsNullOrUndefined(d)&&!e.IsInstanceOfAny(d,...c))throw new TypeError("unexpected type");};e.IsArrayOf=function(d,c){for(let f of d)if(!e.IsInstanceOf(f,c))return!1;return!0};e.IsArrayOfFiniteNumbers=function(d){for(let c of d)if(!e.IsFiniteNumber(c))return!1;return!0};e.RequireArrayOf=function(d,c){for(let f of d);};e.RequireOptionalArrayOf=function(d,c){if(!e.IsNullOrUndefined(d))for(let f of d);};e.RequireArrayOfAny=function(d,...c){for(let f of d);
};e.RequireOptionalArrayOfAny=function(d,...c){if(!e.IsNullOrUndefined(d))for(let f of d);};e.IsDOMNode=function(d,c){return e.IsNullOrUndefined(d)||!e.IsString(d.nodeName)?!1:!c||e.equalsNoCase(d.nodeName,c)};e.RequireDOMNode=function(d,c){if(e.IsNullOrUndefined(d)||!e.IsString(d.nodeName))throw new TypeError("expected DOM node");if(c&&!e.equalsNoCase(d.nodeName,c))throw new TypeError(`expected DOM '${c}' node`);};e.RequireOptionalDOMNode=function(d,c){e.IsNullOrUndefined(d)};e.IsHTMLElement=function(d,
c){return e.IsNullOrUndefined(d)||!e.IsString(d.tagName)?!1:!c||e.equalsNoCase(d.tagName,c)};e.RequireHTMLElement=function(d,c){if(e.IsNullOrUndefined(d)||!e.IsString(d.tagName))throw new TypeError("expected HTML element");if(c&&!e.equalsNoCase(d.tagName,c))throw new TypeError(`expected HTML '${c}' element`);};e.RequireOptionalHTMLElement=function(d,c){e.IsNullOrUndefined(d)};e.IsDrawable=function(d){return e.IsHTMLElement(d,"img")||e.IsHTMLElement(d,"canvas")||e.IsHTMLElement(d,"video")||"undefined"!==
typeof OffscreenCanvas&&d instanceof OffscreenCanvas||"undefined"!==typeof ImageBitmap&&d instanceof ImageBitmap};e.RequireDrawable=function(d){if(!e.IsDrawable(d))throw new TypeError("expected drawable");};e.RequireOptionalDrawable=function(d){e.IsNullOrUndefined(d)};e.IsDrawableOrImageData=function(d){return d instanceof ImageData?!0:e.IsDrawable(d)};e.RequireDrawableOrImageData=function(d){if(!e.IsDrawableOrImageData(d))throw new TypeError("expected drawable or image data");};e.RequireOptionalDrawableOrImageData=
function(d){if(!e.IsNullOrUndefined(d)&&!e.IsDrawableOrImageData(d))throw new TypeError("expected drawable or image data");};e.IsStringLike=function(d){return"string"===typeof d||d instanceof e.HtmlString||d instanceof e.BBString};e.RequireStringLike=function(d){if(!e.IsStringLike(d))throw new TypeError("expected string-like");};e.RequireOptionalStringLike=function(d){e.IsNullOrUndefined(d)};e.RequireAllStringLike=function(...d){for(let c of d);};e.RequireOverride=function(){throw Error("must be overridden");
};e.NotYetImplemented=function(){throw Error("not yet implemented");};e.IsDefined=function(d,...c){if("undefined"===typeof d)return!1;for(let f of c){if("undefined"===typeof d[f])return!1;d=d[f]}return!0};e.IsNullOrUndefined=function(d){return"undefined"===typeof d||null===d};e.AreArrayElementsOfSameType=function(d){let c=d[0].constructor;for(let f of d)if(f.constructor!==c)return!1;return c};e.AreArrayElementsOfType=function(d,c){for(let f of d)if(!(f instanceof c))return!1;return!0};const a=Object.getPrototypeOf(Uint8Array);
e.IsTypedArray=function(d){return e.IsInstanceOf(d,a)};e.RequireTypedArray=function(d){};e.WeakRequireTypedArray=function(d){e.WeakRequireInstanceOf(d,a)};e.WeakRequireAnyInstanceOf=function(d,...c){if(!e.WeakIsAnyInstanceOf(d,...c))throw new TypeError("unexpected type");};e.WeakIsAnyInstanceOf=function(d,...c){for(const f of c)if(e.WeakIsInstanceOf(d,f))return!0;return!1};e.WeakRequireInstanceOf=function(d,c){if(!e.WeakIsInstanceOf(d,c))throw new TypeError("unexpected type");};e.WeakIsInstanceOf=
function(d,c){for(;d=Object.getPrototypeOf(d);)if(d.constructor.name===c.name)return!0;return!1};b.RequireNumber=e.RequireNumber;b.RequireOptionalNumber=e.RequireOptionalNumber;b.RequireFiniteNumber=e.RequireFiniteNumber;b.RequireOptionalFiniteNumber=e.RequireOptionalFiniteNumber;b.RequireString=e.RequireString;b.RequireOptionalString=e.RequireOptionalString;b.RequireObject=e.RequireObject;b.RequireOptionalObject=e.RequireOptionalObject;b.RequireArray=e.RequireArray;b.RequireOptionalArray=e.RequireOptionalArray;
b.RequireFunction=e.RequireFunction;b.RequireOptionalFunction=e.RequireOptionalFunction;b.RequireInstanceOf=e.RequireInstanceOf;b.RequireOptionalInstanceOf=e.RequireOptionalInstanceOf;b.IsNullOrUndefined=e.IsNullOrUndefined}
{"use strict";const e=self.C3,b=new Map;e.RafLog=function(r,...x){b.has(r)||b.set(r,-1);-1===b.get(r)&&b.set(r,requestAnimationFrame(()=>{console.log(`%c${r}`,"font-weight: bold",...x);b.set(r,-1)}))};let a;e.StartMeasure=function(r){performance.mark(r);a||(a=new Map);a.has(r)||a.set(r,{current:0,total:0,average:0,calls:1,toString:function(){return`current => ${this.current.toPrecision(3)} :: average => ${this.average.toPrecision(3)} :: calls => ${this.calls}`}})};e.EndMeasure=function(r){performance.measure("measure",
r);const x=performance.getEntriesByName("measure")[0];r=a.get(r);r.current=x.duration;r.total+=r.current;r.average=r.total/r.calls;r.calls++;console.log(r.toString());performance.clearMarks();performance.clearMeasures()};e.GetCallStack=function(){return Error().stack};e.Debugger=function(){debugger};e.cast=function(r,x){return r&&r instanceof x?r:null};e.getName=function(r){return"undefined"===typeof r?"undefined":null===r?"null":"boolean"===typeof r?"<boolean>":e.IsNumber(r)?"<number>":e.IsString(r)?
"<string>":e.IsArray(r)?"<array>":"symbol"===typeof r?"<"+r.toString()+">":e.IsFunction(r)?r.name&&"Function"!==r.name?r.name:"<anonymous function>":"object"===typeof r?r.constructor&&r.constructor.name&&"Object"!==r.constructor.name?r.constructor.name:"<anonymous object>":"<unknown>"};e.getType=function(r){return null===r?"null":Array.isArray(r)?"array":typeof r};e.range=function*(r,x){if(!isFinite(Math.abs(r-x)))throw Error("Invalid parameters");if(r>x)for(--r;r>=x;r--)yield r;else for(;r<x;r++)yield r};
function d(r,x){r=e.getType(r);x=e.getType(x);return"null"===r||"null"===x?!0:"undefined"===r||"undefined"===x?!1:r===x}let c=new Map,f=new Map,h=new WeakMap,g=new WeakMap;e.DefendHandler={};const l=new Set(["then","splice"]);function m(r){console.warn("[Defence] "+r+" @",e.GetCallStack())}e.DefendHandler.get=function(r,x){x in r||"symbol"===typeof x||l.has(x)||m(`Accessed missing property '${x}' from defended object '${e.getName(r)}', returning undefined`);g.has(r)&&"symbol"!==typeof x&&!l.has(x)&&
m(`Accessed property '${x}' on a released object '${e.getName(r)}'\nObject was originally released at: ${g.get(r)})\nCall stack at access: `);return r[x]};e.DefendHandler.set=function(r,x,y){x in r||c.has(r)||m(`Set non-existent property '${x}' to '${y}' on defended object '${e.getName(r)}'`);d(r[x],y)||c.has(r)||m(`Set '${e.getType(r[x])}' property '${x}' to type '${e.getType(y)}' on defended object '${e.getName(r)}'`);g.has(r)&&m(`Set property '${x}' on a released object '${e.getName(r)}'\nObject was originally released at: ${g.get(r)})\nCall stack at access: `);
r[x]=y;return!0};e.DefendHandler.deleteProperty=function(r,x){throw new ReferenceError(`Cannot delete property '${x}' from defended object '${e.getName(r)}'`);};e.DefendHandler.defineProperty=function(r,x,y){throw new ReferenceError(`Cannot define property '${x}' on defended object '${e.getName(r)}'`);};e.DefendHandler.enumerate=function(r){throw new ReferenceError(`Cannot enumerate defended object '${e.getName(r)}'`);};let u=-1;function w(){u=-1;if(0<c.size||0<f.size){let r=[...new Set([...c.keys()].map(x=>
e.getName(x)))].join();console.warn(`An object derived from DefendedBase was not protected with debugDefend(). This will disable some checks. See the coding guidelines! Possible affected class names: ${r}`);c.clear();f.clear()}}e.DefendedBase=class{constructor(){if(e.isDebugDefend&&e.Supports.Proxies){var r=new.target;r=Object.create(r.prototype);var x=new Proxy(r,e.DefendHandler);c.set(r,x);f.set(x,r);h.set(x,r);-1===u&&(u=requestAnimationFrame(w));return x}}};e.debugDefend=function(r){if(e.isDebugDefend&&
e.Supports.Proxies&&r instanceof e.DefendedBase){if(!f.has(r))return r;let x=f.get(r);f.delete(r);c.delete(x);return r}return e.isDebug?Object.seal(r):r};e.New=function(r,...x){let y;try{y=new r(...x)}catch(D){throw f.clear(),c.clear(),D;}e.isDebugDefend&&p(r,y);return e.debugDefend(y)};e.Release=function(r){(r=h.get(r))&&g.set(r,e.GetCallStack())};e.WasReleased=function(r){return(r=h.get(r))?!!g.get(r):!1};let q=new Map;function t(r){let x=new Set;for(let y in r)x.add(y);return x}function p(r,x){x=
t(x);let y=q.get(r);if(y){let D=[];for(let G of y.values())x.has(G)?x.delete(G):D.push(G);e.appendArray(D,[...x]);D.length&&console.warn(`[Defence] '${e.getName(r)}' constructor creates inconsistent properties: ${D.join(", ")}`)}else q.set(r,x)}e.PerfMark=class{constructor(r){this._name="";r&&this.start(r)}start(r){this._name=r;performance.mark(this._name+"-Start")}end(){performance.mark(this._name+"-End");performance.measure(this._name,this._name+"-Start",this._name+"-End")}next(r){this.end();this._name=
r;performance.mark(this._name+"-Start")}}}
{"use strict";const e=self.C3,b=2*Math.PI,a=Math.PI/180,d=180/Math.PI;e.wrap=function(h,g,l){h=Math.floor(h);g=Math.floor(g);l=Math.floor(l);return h<g?(h=l-(g-h)%(l-g),h===l?0:h):g+(h-g)%(l-g)};e.mapToRange=function(h,g,l,m,u){return(h-g)*(u-m)/(l-g)+m};e.normalize=function(h,g,l){return(h-g)/(l-g)};e.clamp=function(h,g,l){return h<g?g:h>l?l:h};e.clampAngle=function(h){h%=b;0>h&&(h+=b);return h};e.toRadians=function(h){return h*a};e.toDegrees=function(h){return h*d};e.distanceTo=function(h,g,l,m){return Math.hypot(l-
h,m-g)};e.distanceSquared=function(h,g,l,m){h=l-h;g=m-g;return h*h+g*g};e.angleTo=function(h,g,l,m){return Math.atan2(m-g,l-h)};e.angleDiff=function(h,g){if(h===g)return 0;h=Math.sin(h)*Math.sin(g)+Math.cos(h)*Math.cos(g);return 1<=h?0:-1>=h?Math.PI:Math.acos(h)};e.angleRotate=function(h,g,l){let m=Math.sin(h),u=Math.cos(h),w=Math.sin(g),q=Math.cos(g);return Math.acos(m*w+u*q)>l?0<u*w-m*q?e.clampAngle(h+l):e.clampAngle(h-l):e.clampAngle(g)};e.angleClockwise=function(h,g){return 0>=Math.cos(h)*Math.sin(g)-
Math.sin(h)*Math.cos(g)};e.angleLerp=function(h,g,l,m=0){let u=e.angleDiff(h,g);m*=b;return e.angleClockwise(g,h)?e.clampAngle(h+(u+m)*l):e.clampAngle(h-(u+m)*l)};e.angleLerpClockwise=function(h,g,l,m=0){const u=e.angleDiff(h,g);m*=b;return e.angleClockwise(g,h)?e.clampAngle(h+(u+m)*l):e.clampAngle((b-u+m)*l)};e.angleLerpAntiClockwise=function(h,g,l,m=0){const u=e.angleDiff(h,g);m*=b;return e.angleClockwise(g,h)?e.clampAngle((-b+u-m)*l):e.clampAngle(h-(u+m)*l)};e.lerp=function(h,g,l){return h+l*(g-
h)};e.unlerp=function(h,g,l){return h===g?0:(l-h)/(g-h)};e.relerp=function(h,g,l,m,u){return e.lerp(m,u,e.unlerp(h,g,l))};e.qarp=function(h,g,l,m){return e.lerp(e.lerp(h,g,m),e.lerp(g,l,m),m)};e.cubic=function(h,g,l,m,u){return e.lerp(e.qarp(h,g,l,u),e.qarp(g,l,m,u),u)};e.cosp=function(h,g,l){return(h+g+(h-g)*Math.cos(l*Math.PI))/2};e.isPOT=function(h){return 0<h&&0===(h-1&h)};e.nextHighestPowerOfTwo=function(h){--h;for(let g=1;32>g;g<<=1)h|=h>>g;return h+1};e.roundToNearestFraction=function(h,g){return Math.round(h*
g)/g};e.floorToNearestFraction=function(h,g){return Math.floor(h*g)/g};e.round6dp=function(h){return Math.round(1E6*h)/1E6};e.toFixed=function(h,g){h=h.toFixed(g);for(g=h.length-1;0<=g&&"0"===h.charAt(g);--g);0<=g&&"."===h.charAt(g)&&--g;return 0>g?h:h.substr(0,g+1)};e.PackRGB=function(h,g,l){return e.clamp(h,0,255)|e.clamp(g,0,255)<<8|e.clamp(l,0,255)<<16};e.PackRGBAEx=function(h,g,l,m){h=e.clamp(Math.floor(1024*h),-8192,8191);g=e.clamp(Math.floor(1024*g),-8192,8191);l=e.clamp(Math.floor(1024*l),
-8192,8191);m=e.clamp(Math.floor(1023*m),0,1023);0>h&&(h+=16384);0>g&&(g+=16384);0>l&&(l+=16384);return-(274877906944*h+16777216*g+1024*l+m)};e.PackRGBEx=function(h,g,l){return e.PackRGBAEx(h,g,l,1)};function c(h){return 0===h&&0>1/h}e.GetRValue=function(h){if(0<=h)return(h&255)/255;h=Math.floor(-h/274877906944);8191<h&&(h-=16384);return h/1024};e.GetGValue=function(h){if(0<=h)return((h&65280)>>8)/255;h=Math.floor(-h%274877906944/16777216);8191<h&&(h-=16384);return h/1024};e.GetBValue=function(h){if(0<=
h)return((h&16711680)>>16)/255;h=Math.floor(-h%16777216/1024);8191<h&&(h-=16384);return h/1024};e.GetAValue=function(h){return c(h)?0:0<=h?1:Math.floor(-h%1024)/1023};e.greatestCommonDivisor=function(h,g){h=Math.floor(h);for(g=Math.floor(g);0!==g;){let l=g;g=h%g;h=l}return h};const f=[[3,2],[4,3],[5,4],[5,3],[6,5],[14,9],[16,9],[16,10],[21,9]];e.getAspectRatio=function(h,g){h=Math.floor(h);g=Math.floor(g);if(h===g)return[1,1];for(var l of f){let m=h/l[0]*l[1];if(1>Math.abs(g-m))return l.slice(0);
m=h/l[1]*l[0];if(1>Math.abs(g-m))return[l[1],l[0]]}l=e.greatestCommonDivisor(h,g);return[h/l,g/l]};e.segmentsIntersect=function(h,g,l,m,u,w,q,t){var p=Math.min(h,l),r=Math.max(u,q);if(Math.max(h,l)<Math.min(u,q)||p>r)return!1;p=Math.min(g,m);r=Math.max(w,t);if(Math.max(g,m)<Math.min(w,t)||p>r)return!1;p=u-h+q-l;r=w-g+t-m;h=l-h;g=m-g;u=q-u;w=t-w;t=Math.abs(g*u-w*h);return Math.abs(u*r-w*p)>t?!1:Math.abs(h*r-g*p)<=t};e.segmentsIntersectPreCalc=function(h,g,l,m,u,w,q,t,p,r,x,y){const D=Math.max(p,x);
if(w<Math.min(p,x)||u>D)return!1;u=Math.max(r,y);if(t<Math.min(r,y)||q>u)return!1;q=p-h+x-l;t=r-g+y-m;h=l-h;g=m-g;p=x-p;r=y-r;y=Math.abs(g*p-r*h);return Math.abs(p*t-r*q)>y?!1:Math.abs(h*t-g*q)<=y};e.segmentIntersectsQuad=function(h,g,l,m,u){const w=Math.min(h,l),q=Math.max(h,l),t=Math.min(g,m),p=Math.max(g,m),r=u.getTlx(),x=u.getTly(),y=u.getTrx(),D=u.getTry(),G=u.getBrx(),A=u.getBry(),F=u.getBlx();u=u.getBly();return e.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,r,x,y,D)||e.segmentsIntersectPreCalc(h,
g,l,m,w,q,t,p,y,D,G,A)||e.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,G,A,F,u)||e.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,F,u,r,x)};e.segmentIntersectsAnyN=function(h,g,l,m,u){const w=Math.min(h,l),q=Math.max(h,l),t=Math.min(g,m),p=Math.max(g,m);let r=0;for(let x=u.length-4;r<=x;r+=2)if(e.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,u[r],u[r+1],u[r+2],u[r+3]))return!0;return e.segmentsIntersectPreCalc(h,g,l,m,w,q,t,p,u[r],u[r+1],u[0],u[1])};e.rayIntersect=function(h,g,l,m,u,w,q,t){l-=h;w=t-w;const p=l*
w-(m-g)*(q-u);if(0===p)return 2;m=((g-m)*(q-h)+l*(t-g))/p;return 0<m&&1.000001>m?(w*(q-h)+(u-q)*(t-g))/p:2};e.rayIntersectExtended=function(h,g,l,m,u,w,q,t,p){const r=(q-u)*p;p*=t-w;return e.rayIntersect(h,g,l,m,u-r,w-p,q+r,t+p)};e.isPointInTriangleInclusive=function(h,g,l,m,u,w,q,t){u-=l;w-=m;q-=l;t-=m;h-=l;l=g-m;g=u*u+w*w;m=u*q+w*t;u=u*h+w*l;w=q*q+t*t;q=q*h+t*l;t=1/(g*w-m*m);w=(w*u-m*q)*t;u=(g*q-m*u)*t;return 0<=w&&0<=u&&1>=w+u};e.triangleCartesianToBarycentric=function(h,g,l,m,u,w,q,t){u-=l;w-=
m;q-=l;t-=m;h-=l;const p=g-m;g=u*u+w*w;m=u*q+w*t;l=q*q+t*t;u=h*u+p*w;w=h*q+p*t;q=g*l-m*m;t=(l*u-m*w)/q;u=(g*w-m*u)/q;return[1-t-u,t,u]};e.triangleBarycentricToCartesian=function(h,g,l,m,u,w,q,t,p){return[h*m+g*w+l*t,h*u+g*q+l*p]}}
{"use strict";const e=self.C3;let b=null,a="";if("undefined"!==typeof document){b=document;const l=document.querySelector("base");if(a=l&&l.hasAttribute("href")?l.getAttribute("href"):"")a.startsWith("/")&&(a=a.substr(1)),a.endsWith("/")||(a+="/")}e.GetBaseHref=function(){return a};e.GetBaseURL=function(){if(!b)return"";const l=b.location;return e.GetPathFromURL(l.origin+l.pathname)+a};e.GetPathFromURL=function(l){if(!l.length||l.endsWith("/")||l.endsWith("\\"))return l;const m=Math.max(l.lastIndexOf("/"),
l.lastIndexOf("\\"));return-1===m?"":l.substr(0,m+1)};e.GetFilenameFromURL=function(l){if(!l.length)return l;if(l.endsWith("/")||l.endsWith("\\"))return"";const m=Math.max(l.lastIndexOf("/"),l.lastIndexOf("\\"));return-1===m?l:l.substr(m+1)};e.GetFileExtension=function(l){let m=l.lastIndexOf(".");return 1>m?"":l.substr(m)};e.GetFileNamePart=function(l){let m=l.lastIndexOf(".");return 1>m?l:l.substr(0,m)};e.NormalizeFileSeparator=function(l){return l.replace(/\\/g,"/")};e.IsFileExtension=function(l,
m){l=l?e.GetFileExtension(l).slice(1):"";return m===l};e.FileNameEquals=function(l,m){let u,w;e.IsFileLike(l)&&(u=e.GetFileNamePart(l.name));e.IsString(l)&&(u=e.GetFileNamePart(l));e.IsFileLike(m)&&(w=e.GetFileNamePart(m.name));e.IsString(m)&&(w=e.GetFileNamePart(m));return u===w};e.ParseFilePath=function(l){l=e.NormalizeFileSeparator(l);let m=/^\w:\//.exec(l);m?(m=m[0],l=l.slice(3),"/"!==l[0]&&(l="/"+l)):m="";l=l.replace(/\/{2,}/g,"/");1<l.length&&"/"===l.slice(-1)&&(l=l.slice(0,-1));var u=l.lastIndexOf("/")+
1;let w="",q=l,t="";0<u&&(w=l.slice(0,u),q=l.slice(u));l=q;u=q.lastIndexOf(".");0<u&&(t=q.slice(u),l=q.slice(0,-t.length));return{dir:w,base:q,name:l,root:m,ext:t,full:m+w+q}};e.Wait=function(l,m){return new Promise((u,w)=>{self.setTimeout(u,l,m)})};e.swallowException=function(l){try{l()}catch(m){e.isDebug&&console.warn("Swallowed exception: ",m)}};e.noop=function(){};e.equalsNoCase=function(l,m){return"string"!==typeof l||"string"!==typeof m?!1:l===m||l.normalize().toLowerCase()===m.normalize().toLowerCase()};
e.equalsCase=function(l,m){return"string"!==typeof l||"string"!==typeof m?!1:l===m?!0:l.normalize()===m.normalize()};e.typedArraySet16=function(l,m,u){l[u++]=m[0];l[u++]=m[1];l[u++]=m[2];l[u++]=m[3];l[u++]=m[4];l[u++]=m[5];l[u++]=m[6];l[u++]=m[7];l[u++]=m[8];l[u++]=m[9];l[u++]=m[10];l[u++]=m[11];l[u++]=m[12];l[u++]=m[13];l[u++]=m[14];l[u]=m[15]};e.truncateArray=function(l,m){l.length=m};e.clearArray=function(l){l&&0!==l.length&&e.truncateArray(l,0)};e.clear2DArray=function(l){if(l){for(let m=0;m<
l.length;m++)e.truncateArray(l[m],0);e.truncateArray(l,0)}};e.extendArray=function(l,m,u){m|=0;var w=l.length;if(!(m<=w))for(;w<m;++w)l.push(u)};e.resizeArray=function(l,m,u){m|=0;const w=l.length;m<w?e.truncateArray(l,m):m>w&&e.extendArray(l,m,u)};e.shallowAssignArray=function(l,m){e.clearArray(l);e.appendArray(l,m)};e.appendArray=function(l,m){if(1E4>m.length)l.push(...m);else for(let u=0,w=m.length;u<w;++u)l.push(m[u])};e.arrayRemove=function(l,m){m=Math.floor(m);if(!(0>m||m>=l.length)){for(var u=
l.length-1;m<u;++m)l[m]=l[m+1];e.truncateArray(l,u)}};e.arrayFindRemove=function(l,m){m=l.indexOf(m);0<=m&&l.splice(m,1)};e.arraysEqual=function(l,m){let u=l.length;if(m.length!==u)return!1;for(let w=0;w<u;++w)if(l[w]!==m[w])return!1;return!0};e.arrayFilterOut=function(l,m){let u=[],w=0;for(let q=0,t=l.length;q<t;++q){let p=l[q];m(p)?u.push(p):(l[w]=p,++w)}e.truncateArray(l,w);return u};e.arrayRemoveAllInSet=function(l,m){const u=l.length;let w=0;for(let q=0,t=l.length;q<t;++q){let p=l[q];m.has(p)||
(l[w++]=p)}e.truncateArray(l,w);return u-w};e.isArrayIndexInBounds=function(l,m){return l!==Math.floor(l)?!1:0<=l&&l<m.length};e.validateArrayIndex=function(l,m){if(!e.isArrayIndexInBounds(l,m))throw new RangeError("array index out of bounds");};e.cloneArray=function(l){return l.slice()};e.deepCloneArray=function(l,m){let u=[];for(let w of l)if(e.IsObject(w)){l=m(w);if(!l)throw Error("missing clone");if(l.constructor!==w.constructor)throw Error("object is not a clone");u.push(l)}else e.IsArray(w)?
u.push(e.deepCloneArray(w,m)):u.push(w);return u};e.clone2DArray=function(l){let m=[];for(let u of l)m.push(u.slice());return m};e.mergeSets=function(l,m){return new Set([...l,...m])};e.mergeSetsInPlace=function(l,m){for(const u of m)l.add(u);return l};e.first=function(l){for(let m of l)return m;return null};e.xor=function(l,m){return!l!==!m};e.compare=function(l,m,u){switch(m){case 0:return l===u;case 1:return l!==u;case 2:return l<u;case 3:return l<=u;case 4:return l>u;case 5:return l>=u;default:return!1}};
e.hasAnyOwnProperty=function(l){for(let m in l)if(l.hasOwnProperty(m))return!0;return!1};e.PromiseAllWithProgress=function(l,m){return l.length?new Promise((u,w)=>{const q=[];let t=0,p=!1;for(let r=0,x=l.length;r<x;++r)q.push(void 0),l[r].then(y=>{p||(q[r]=y,++t,t===l.length?u(q):m(t,l.length))}).catch(y=>{p=!0;w(y)})}):Promise.resolve([])};let d=[];e.AddLibraryMemoryCallback=function(l){d.push(l)};e.GetEstimatedLibraryMemoryUsage=function(){let l=0;for(let m of d){let u=m();l+=u}return Math.floor(l)};
let c=1;const f=new Map,h=new MessageChannel;h.port2.onmessage=function(l){l=l.data;const m=f.get(l);f.delete(l);m&&m(performance.now())};e.RequestUnlimitedAnimationFrame=function(l){const m=c++;f.set(m,l);h.port1.postMessage(m);return m};e.CancelUnlimitedAnimationFrame=function(l){f.delete(l)};e.PostTask=e.RequestUnlimitedAnimationFrame;e.WaitForNextTask=function(){return new Promise(l=>e.PostTask(l))};const g=new Set;e.RequestPostAnimationFrame=function(l){const m=self.requestAnimationFrame(async u=>
{await e.WaitForNextTask();g.has(m)&&(g.delete(m),l(u))});g.add(m);return m};e.CancelPostAnimationFrame=function(l){g.has(l)&&(self.cancelAnimationFrame(l),g.delete(l))}}
{"use strict";const e=self.C3;e.IsAbsoluteURL=function(b){return/^(?:[a-z\-]+:)?\/\//.test(b)||"data:"===b.substr(0,5)||"blob:"===b.substr(0,5)};e.IsRelativeURL=function(b){return!e.IsAbsoluteURL(b)};e.ThrowIfNotOk=function(b){if(!b.ok)throw Error(`fetch '${b.url}' response returned ${b.status} ${b.statusText}`);};e.FetchOk=function(b,a){return fetch(b,a).then(d=>{e.ThrowIfNotOk(d);return d})};e.FetchText=function(b){return e.FetchOk(b).then(a=>a.text())};e.FetchJson=function(b){return e.FetchOk(b).then(a=>
a.json())};e.FetchBlob=function(b){return e.FetchOk(b).then(a=>a.blob())};e.FetchArrayBuffer=function(b){return e.FetchOk(b).then(a=>a.arrayBuffer())};e.FetchImage=function(b){return new Promise((a,d)=>{const c=new Image;c.onload=()=>a(c);c.onerror=f=>d(f);c.src=b})};e.BlobToArrayBuffer=function(b){return"function"===typeof b.arrayBuffer?b.arrayBuffer():new Promise((a,d)=>{const c=new FileReader;c.onload=()=>a(c.result);c.onerror=()=>d(c.error);c.readAsArrayBuffer(b)})};e.BlobToString=function(b){return"function"===
typeof b.text?b.text():new Promise((a,d)=>{const c=new FileReader;c.onload=()=>a(c.result);c.onerror=()=>d(c.error);c.readAsText(b)})};e.BlobToJson=function(b){return e.BlobToString(b).then(a=>JSON.parse(a))};e.BlobToImage=async function(b,a){b=URL.createObjectURL(b);try{const d=await e.FetchImage(b);URL.revokeObjectURL(b);b="";a&&"function"===typeof d.decode&&await d.decode();return d}finally{b&&URL.revokeObjectURL(b)}};e.CreateCanvas=function(b,a){if("undefined"!==typeof document&&"function"===
typeof document.createElement){const d=document.createElement("canvas");d.width=b;d.height=a;return d}return new OffscreenCanvas(b,a)};e.CanvasToBlob=function(b,a,d){"number"!==typeof d&&(d=1);a=a||"image/png";d=e.clamp(d,0,1);return b.toBlob?new Promise(c=>b.toBlob(c,a,d)):b.convertToBlob?b.convertToBlob({type:a,quality:d}):e.Asyncify(()=>e.CanvasToBlobSync(b,a,d))};e.CanvasToBlobSync=function(b,a,d){"number"!==typeof d&&(d=1);a=a||"image/png";d=e.clamp(d,0,1);return e.DataURIToBinaryBlobSync(b.toDataURL(a,
d))};e.DataURIToBinaryBlobSync=function(b){b=e.ParseDataURI(b);return e.BinaryStringToBlob(b.data,b.mime_type)};e.ParseDataURI=function(b){if("data:"!==b.substr(0,5))throw new URIError("expected data: uri");var a=b.indexOf(",");if(0>a)throw new URIError("expected comma in data: uri");var d=b.substring(5,a);b=b.substring(a+1);a=d.split(";");d=a[0]||"";let c=a[2];b="base64"===a[1]||"base64"===c?atob(b):decodeURIComponent(b);return{mime_type:d,data:b}};e.BinaryStringToBlob=function(b,a){var d=b.length;
let c=d>>2,f=new Uint8Array(d),h=new Uint32Array(f.buffer,0,c),g,l;for(l=g=0;g<c;++g)h[g]=b.charCodeAt(l++)|b.charCodeAt(l++)<<8|b.charCodeAt(l++)<<16|b.charCodeAt(l++)<<24;for(d&=3;d--;)f[l]=b.charCodeAt(l),++l;return a?new Blob([f],{type:a}):new Blob([f])};e.DrawableToBlob=function(b,a,d){const c=e.CreateCanvas(b.width,b.height);c.getContext("2d").drawImage(b,0,0);return e.CanvasToBlob(c,a,d)};e.ImageDataToBlobSync=function(b,a,d){const c=e.CreateCanvas(b.width,b.height);c.getContext("2d").putImageData(b,
0,0);return e.CanvasToBlobSync(c,a,d)};e.ImageDataToBlob=function(b,a,d){if(e.Supports.ImageBitmapOptions)return createImageBitmap(b,{premultiplyAlpha:"none"}).then(c=>e.DrawableToBlob(c,a,d));if(e.Supports.ImageBitmap)return createImageBitmap(b).then(c=>e.DrawableToBlob(c,a,d));{const c=e.CreateCanvas(b.width,b.height);c.getContext("2d").putImageData(b,0,0);return e.CanvasToBlob(c,a,d)}};e.CopySet=function(b,a){b.clear();for(const d of a)b.add(d)};e.MapToObject=function(b){const a=Object.create(null);
for(const [d,c]of b.entries())a[d]=c;return a};e.ObjectToMap=function(b,a){a.clear();for(const [d,c]of Object.entries(b))a.set(d,c)};e.ToSuperJSON=function d(a){if("object"===typeof a&&null!==a){if(a instanceof Set)return{_c3type_:"set",data:[...a].map(c=>d(c))};if(a instanceof Map)return{_c3type_:"map",data:[...a].map(c=>[c[0],d(c[1])])};{const c=Object.create(null);for(const [f,h]of Object.entries(a))c[f]=d(h);return c}}return a};e.FromSuperJSON=function c(d){if("object"===typeof d&null!==d){if("set"===
d._c3type_)return new Set(d.data.map(f=>c(f)));if("map"===d._c3type_)return new Map(d.data.map(f=>[f[0],c(f[1])]));{const f=Object.create(null);for(const [h,g]of Object.entries(d))f[h]=c(g);return f}}return d};e.CSSToCamelCase=function(d){let c="",f=!1;for(const h of d)"-"===h?f=!0:f?(c+=h.toUpperCase(),f=!1):c+=h;return c};e.IsIterator=function(d){return"object"===typeof d&&"function"===typeof d.next};e.MakeFilledArray=function(d,c){const f=[];if("function"===typeof c)for(var h=0;h<d;++h)f.push(c());
else for(h=0;h<d;++h)f.push(c);return f}}
{"use strict";const e=self.C3,b=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?/i,a=/([0-9.]+),([0-9.]+)%?,([0-9.]+)%?,([0-9.])/i;function d(f){return 0===f.length?"00":1===f.length?"0"+f:f}function c(f,h,g){0>g&&(g+=1);1<g&&--g;return g<1/6?f+6*(h-f)*g:.5>g?h:g<2/3?f+(h-f)*(2/3-g)*6:f}e.Color=class{constructor(f,h,g,l){this._a=this._b=this._g=this._r=0;f instanceof e.Color?this.set(f):this.setRgba(f||0,h||0,g||0,l||0)}setRgb(f,h,g){this._r=+f;this._g=+h;this._b=+g;this.clamp();return this}setRgba(f,h,g,l){this._r=
+f;this._g=+h;this._b=+g;this._a=+l;this.clamp();return this}set(f){this._r=f._r;this._g=f._g;this._b=f._b;this._a=f._a;return this}copy(f){return this.set(f)}add(f){this._r+=f._r;this._g+=f._g;this._b+=f._b;this._a+=f._a;this.clamp()}addRgb(f,h,g,l=0){this._r+=+f;this._g+=+h;this._b+=+g;this._a+=+l;this.clamp()}diff(f){this.setR(Math.max(this._r,f._r)-Math.min(this._r,f._r));this.setG(Math.max(this._g,f._g)-Math.min(this._g,f._g));this.setB(Math.max(this._b,f._b)-Math.min(this._b,f._b));this.setA(Math.max(this._a,
f._a)-Math.min(this._a,f._a));this.clamp()}copyRgb(f){this._r=f._r;this._g=f._g;this._b=f._b}setR(f){this._r=e.clamp(+f,0,1)}getR(){return this._r}setG(f){this._g=e.clamp(+f,0,1)}getG(){return this._g}setB(f){this._b=e.clamp(+f,0,1)}getB(){return this._b}setA(f){this._a=e.clamp(+f,0,1)}getA(){return this._a}clone(){return e.New(e.Color,this._r,this._g,this._b,this._a)}toArray(){return[this._r,this._g,this._b,this._a]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(f,h){f[h++]=
this._r;f[h++]=this._g;f[h++]=this._b;f[h]=this._a}writeRGBToTypedArray(f,h){f[h++]=this._r;f[h++]=this._g;f[h]=this._b}equals(f){return this._r===f._r&&this._g===f._g&&this._b===f._b&&this._a===f._a}equalsIgnoringAlpha(f){return this._r===f._r&&this._g===f._g&&this._b===f._b}equalsRgb(f,h,g){return this._r===f&&this._g===h&&this._b===g}equalsRgba(f,h,g,l){return this._r===f&&this._g===h&&this._b===g&&this._a===l}equalsF32Array(f,h){return f[h]===Math.fround(this._r)&&f[h+1]===Math.fround(this._g)&&
f[h+2]===Math.fround(this._b)&&f[h+3]===Math.fround(this._a)}equalsRGBF32Array(f,h){return f[h]===Math.fround(this._r)&&f[h+1]===Math.fround(this._g)&&f[h+2]===Math.fround(this._b)}multiply(f){this._r*=f._r;this._g*=f._g;this._b*=f._b;this._a*=f._a}multiplyAlpha(f){this._r*=f;this._g*=f;this._b*=f;this._a*=f}premultiply(){this._r*=this._a;this._g*=this._a;this._b*=this._a;return this}unpremultiply(){this._r/=this._a;this._g/=this._a;this._b/=this._a;return this}clamp(){this._r=e.clamp(this._r,0,1);
this._g=e.clamp(this._g,0,1);this._b=e.clamp(this._b,0,1);this._a=e.clamp(this._a,0,1);return this}setFromRgbValue(f){this._r=e.GetRValue(f);this._g=e.GetGValue(f);this._b=e.GetBValue(f);this._a=e.GetAValue(f)}getCssRgb(f,h,g){f=e.IsFiniteNumber(f)?f:this.getR();h=e.IsFiniteNumber(h)?h:this.getG();g=e.IsFiniteNumber(g)?g:this.getB();return`rgb(${100*f}%, ${100*h}%, ${100*g}%)`}getCssRgba(f,h,g,l){f=e.IsFiniteNumber(f)?f:this.getR();h=e.IsFiniteNumber(h)?h:this.getG();g=e.IsFiniteNumber(g)?g:this.getB();
l=e.IsFiniteNumber(l)?l:this.getA();return`rgba(${100*f}%, ${100*h}%, ${100*g}%, ${l})`}toHexString(){const f=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return"#"+d(f.toString(16))+d(h.toString(16))+d(g.toString(16))}parseHexString(f){if("string"!==typeof f)return!1;f=f.trim();"#"===f.charAt(0)&&(f=f.substr(1));let h,g;if(3===f.length)h=parseInt(f[0],16)/15,g=parseInt(f[1],16)/15,f=parseInt(f[2],16)/15;else if(6===f.length)h=parseInt(f.substr(0,2),16)/
255,g=parseInt(f.substr(2,2),16)/255,f=parseInt(f.substr(4,2),16)/255;else return!1;isFinite(h)&&this.setR(h);isFinite(g)&&this.setG(g);isFinite(f)&&this.setB(f);this.setA(1);return!0}toCommaSeparatedRgb(){const f=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return`${f}, ${h}, ${g}`}toRgbArray(){const f=Math.round(255*this.getR()),h=Math.round(255*this.getG()),g=Math.round(255*this.getB());return[f,h,g]}parseCommaSeparatedRgb(f){if("string"!==typeof f)return!1;
f=f.replace(/^rgb\(|\)|%/,"");var h=f.split(",");if(3>h.length)return!1;f=parseInt(h[0].trim(),10)/255;const g=parseInt(h[1].trim(),10)/255;h=parseInt(h[2].trim(),10)/255;isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(h)&&this.setB(h);this.setA(1);return!0}parseCommaSeparatedPercentageRgb(f){if("string"!==typeof f)return!1;f=f.replace(/^rgb\(|\)|%/,"");var h=f.split(",");if(3>h.length)return!1;f=parseInt(h[0].trim(),10)/100;const g=parseInt(h[1].trim(),10)/100;h=parseInt(h[2].trim(),
10)/100;isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(h)&&this.setB(h);this.setA(1);return!0}parseCommaSeparatedRgba(f){if("string"!==typeof f)return!1;f=f.replace(/^rgba\(|\)|%/,"");var h=f.split(",");if(4>h.length)return!1;f=parseInt(h[0].trim(),10)/255;const g=parseInt(h[1].trim(),10)/255,l=parseInt(h[2].trim(),10)/255;h=parseFloat(h[3].trim());isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(l)&&this.setB(l);isFinite(h)&&this.setA(h);return!0}parseCommaSeparatedPercentageRgba(f){if("string"!==
typeof f)return!1;f=f.replace(/^rgba\(|\)|%/,"");var h=f.split(",");if(4>h.length)return!1;f=parseInt(h[0].trim(),10)/100;const g=parseInt(h[1].trim(),10)/100,l=parseInt(h[2].trim(),10)/100;h=parseFloat(h[3].trim());isFinite(f)&&this.setR(f);isFinite(g)&&this.setG(g);isFinite(l)&&this.setB(l);isFinite(h)&&this.setA(h);return!0}parseString(f){if("string"!==typeof f)return!1;f=f.replace(/\s+/,"");if(f.includes(",")){if(f.startsWith("rgb("))return f.includes("%")?this.parseCommaSeparatedPercentageRgb(f):
this.parseCommaSeparatedRgb(f);if(f.startsWith("rgba("))return f.includes("%")?this.parseCommaSeparatedPercentageRgba(f):this.parseCommaSeparatedRgba(f);if(f.startsWith("hsl(")||f.startsWith("hsla("))return this.parseHSLString(f);{const h=f.split(",");if(f.includes("%")){if(3===h.length)return this.parseCommaSeparatedPercentageRgb(f);if(4===h.length)return this.parseCommaSeparatedPercentageRgba(f)}else{if(3===h.length)return this.parseCommaSeparatedRgb(f);if(4===h.length)return this.parseCommaSeparatedRgba(f)}return!1}}return this.parseHexString(f)}toJSON(){return[this._r,
this._g,this._b,this._a]}setFromHSLA(f,h,g,l){f%=360;h=e.clamp(h,0,100);g=e.clamp(g,0,100);l=e.clamp(l,0,1);f/=360;h/=100;g/=100;if(0===h)g=h=f=g;else{const m=.5>g?g*(1+h):g+h-g*h,u=2*g-m;g=c(u,m,f+1/3);h=c(u,m,f);f=c(u,m,f-1/3)}this.setR(g);this.setG(h);this.setB(f);this.setA(l);return this}parseHSLString(f){var h=f.replace(/ |hsl|hsla|\(|\)|;/gi,"");f=b.exec(h);h=a.exec(h);return f&&4===f.length?(this.setFromHSLA(+f[1],+f[2],+f[3],1),!0):h&&5===h.length?(this.setFromHSLA(+f[1],+f[2],+f[3],+f[4]),
!0):!1}toHSLAString(){var f=this._r;const h=this._g,g=this._b,l=this._a,m=e.Color.GetHue(f,h,g),u=e.Color.GetSaturation(f,h,g);f=e.Color.GetLuminosity(f,h,g);return`hsla(${m}, ${u}%, ${f}%, ${l})`}toHSLAArray(){const f=this._r,h=this._g,g=this._b;return[e.Color.GetHue(f,h,g),e.Color.GetSaturation(f,h,g),e.Color.GetLuminosity(f,h,g),this._a]}setFromJSON(f){!Array.isArray(f)||3>f.length||(this._r=f[0],this._g=f[1],this._b=f[2],this._a=4<=f.length?f[3]:1)}set r(f){this.setR(f)}get r(){return this.getR()}set g(f){this.setG(f)}get g(){return this.getG()}set b(f){this.setB(f)}get b(){return this.getB()}set a(f){this.setA(f)}get a(){return this.getA()}setAtIndex(f,
h){switch(f){case 0:this.setR(h);break;case 1:this.setG(h);break;case 2:this.setB(h);break;case 3:this.setA(h);break;default:throw new RangeError("invalid color index");}}getAtIndex(f){switch(f){case 0:return this.getR();case 1:return this.getG();case 2:return this.getB();case 3:return this.getA();default:throw new RangeError("invalid color index");}}static Equals(f,h){let g;if(Array.isArray(f))g=new e.Color,g.setFromJSON(f);else if(f instanceof e.Color)g=f;else throw Error("unexpected type");if(Array.isArray(h))f=
new e.Color,f.setFromJSON(h);else if(h instanceof e.Color)f=h;else throw Error("unexpected type");return g.equals(f)}static DiffChannel(f,h){return e.clamp(Math.max(f,h)-Math.min(f,h),0,1)}static Diff(f,h){const g=new e.Color;g.setR(Math.max(f._r,h._r)-Math.min(f._r,h._r));g.setG(Math.max(f._g,h._g)-Math.min(f._g,h._g));g.setB(Math.max(f._b,h._b)-Math.min(f._b,h._b));g.setA(Math.max(f._a,h._a)-Math.min(f._a,h._a));return g}static DiffNoAlpha(f,h){const g=new e.Color(0,0,0,1);g.setR(Math.max(f._r,
h._r)-Math.min(f._r,h._r));g.setG(Math.max(f._g,h._g)-Math.min(f._g,h._g));g.setB(Math.max(f._b,h._b)-Math.min(f._b,h._b));return g}static GetHue(f,h,g){const l=Math.max(f,h,g),m=Math.min(f,h,g);if(l===m)return 0;let u=0;switch(l){case f:u=(h-g)/(l-m)+(h<g?6:0);break;case h:u=(g-f)/(l-m)+2;break;case g:u=(f-h)/(l-m)+4}return Math.round(u/6*360)}static GetSaturation(f,h,g){const l=Math.max(f,h,g);f=Math.min(f,h,g);if(l===f)return 0;h=l-f;return Math.round(100*(.5<(l+f)/2?h/(2-l-f):h/(l+f)))}static GetLuminosity(f,
h,g){const l=Math.max(f,h,g);return l?Math.round((l+Math.min(f,h,g))/2*100):0}};e.Color.White=Object.freeze(e.New(e.Color,1,1,1,1));e.Color.Black=Object.freeze(e.New(e.Color,0,0,0,1));e.Color.TransparentBlack=Object.freeze(e.New(e.Color,0,0,0,0))}
{"use strict";const e=self.C3;e.Vector2=class{constructor(b,a){this._y=this._x=0;b instanceof e.Vector2?this.copy(b):this.set(b||0,a||0)}set(b,a){this._x=+b;this._y=+a}copy(b){this._x=b._x;this._y=b._y}equals(b){return this._x===b._x&&this._y===b._y}equalsValues(b,a){return this._x===b&&this._y===a}equalsF32Array(b,a){return b[a]===Math.fround(this._x)&&b[a+1]===Math.fround(this._y)}setX(b){this._x=+b}getX(){return this._x}setY(b){this._y=+b}getY(){return this._y}toArray(){return[this._x,this._y]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(b,
a){b[a++]=this._x;b[a]=this._y}offset(b,a){this._x+=+b;this._y+=+a}scale(b,a){this._x*=b;this._y*=a}divide(b,a){this._x/=b;this._y/=a}round(){this._x=Math.round(this._x);this._y=Math.round(this._y)}floor(){this._x=Math.floor(this._x);this._y=Math.floor(this._y)}ceil(){this._x=Math.ceil(this._x);this._y=Math.ceil(this._y)}angle(){return e.angleTo(0,0,this._x,this._y)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.sqrt(this.lengthSquared())}rotatePrecalc(b,a){const d=this._x*
a-this._y*b;this._y=this._y*a+this._x*b;this._x=d}rotate(b){0!==b&&this.rotatePrecalc(Math.sin(b),Math.cos(b))}rotateAbout(b,a,d){0===b||a===this._x&&d===this._y||(this._x-=a,this._y-=d,this.rotatePrecalc(Math.sin(b),Math.cos(b)),this._x+=+a,this._y+=+d)}move(b,a){0!==a&&(this._x+=Math.cos(b)*a,this._y+=Math.sin(b)*a)}normalize(){const b=this.length();0!==b&&1!==b&&(this._x/=b,this._y/=b)}clamp(b,a){this._x=e.clamp(this._x,b,a);this._y=e.clamp(this._y,b,a)}}}
{"use strict";const e=self.C3;e.Rect=class{constructor(b,a,d,c){this._bottom=this._right=this._top=this._left=0;b instanceof e.Rect?this.copy(b):this.set(b||0,a||0,d||0,c||0)}set(b,a,d,c){this._left=+b;this._top=+a;this._right=+d;this._bottom=+c}setWH(b,a,d,c){b=+b;a=+a;this._left=b;this._top=a;this._right=b+ +d;this._bottom=a+ +c}copy(b){this._left=+b._left;this._top=+b._top;this._right=+b._right;this._bottom=+b._bottom}clone(){return new e.Rect(this._left,this._top,this._right,this._bottom)}static Merge(b,
a){const d=new e.Rect;d.setLeft(Math.min(b._left,a._left));d.setTop(Math.min(b._top,a._top));d.setRight(Math.max(b._right,a._right));d.setBottom(Math.max(b._bottom,a._bottom));return d}static FromObject(b){return new e.Rect(b.left,b.top,b.right,b.bottom)}equals(b){return this._left===b._left&&this._top===b._top&&this._right===b._right&&this._bottom===b._bottom}equalsWH(b,a,d,c){return this._left===b&&this._top===a&&this.width()===d&&this.height()===c}equalsF32Array(b,a){return b[a]===Math.fround(this._left)&&
b[a+1]===Math.fround(this._top)&&b[a+2]===Math.fround(this._right)&&b[a+3]===Math.fround(this._bottom)}setLeft(b){this._left=+b}getLeft(){return this._left}setTop(b){this._top=+b}getTop(){return this._top}setRight(b){this._right=+b}getRight(){return this._right}setBottom(b){this._bottom=+b}getBottom(){return this._bottom}toArray(){return[this._left,this._top,this._right,this._bottom]}toTypedArray(){return new Float64Array(this.toArray())}toDOMRect(){return new DOMRect(this._left,this._top,this.width(),
this.height())}writeToTypedArray(b,a){b[a++]=this._left;b[a++]=this._top;b[a++]=this._right;b[a]=this._bottom}writeAsQuadToTypedArray(b,a){b[a++]=this._left;b[a++]=this._top;b[a++]=this._right;b[a++]=this._top;b[a++]=this._right;b[a++]=this._bottom;b[a++]=this._left;b[a]=this._bottom}writeAsQuadToTypedArray3D(b,a,d){b[a++]=this._left;b[a++]=this._top;b[a++]=d;b[a++]=this._right;b[a++]=this._top;b[a++]=d;b[a++]=this._right;b[a++]=this._bottom;b[a++]=d;b[a++]=this._left;b[a++]=this._bottom;b[a]=d}width(){return this._right-
this._left}height(){return this._bottom-this._top}midX(){return(this._left+this._right)/2}midY(){return(this._top+this._bottom)/2}offset(b,a){b=+b;a=+a;this._left+=b;this._top+=a;this._right+=b;this._bottom+=a}offsetLeft(b){this._left+=+b}offsetTop(b){this._top+=+b}offsetRight(b){this._right+=+b}offsetBottom(b){this._bottom+=+b}toSquare(b){if("x"!==b)throw Error("invalid axis, only 'x' supported");this._bottom=this._top<this._bottom?this._left<this._right?this._top+this.width():this._top-this.width():
this._left<this._right?this._top-this.width():this._top+this.width()}inflate(b,a){b=+b;a=+a;this._left-=b;this._top-=a;this._right+=b;this._bottom+=a}deflate(b,a){b=+b;a=+a;this._left+=b;this._top+=a;this._right-=b;this._bottom-=a}multiply(b,a){this._left*=b;this._top*=a;this._right*=b;this._bottom*=a}divide(b,a){this._left/=b;this._top/=a;this._right/=b;this._bottom/=a}mirrorAround(b){this._left=+b-this._left;this._right=+b-this._right}flipAround(b){this._top=+b-this._top;this._bottom=+b-this._bottom}swapLeftRight(){const b=
this._left;this._left=this._right;this._right=b}swapTopBottom(){const b=this._top;this._top=this._bottom;this._bottom=b}shuntY(b){const a=this._top;this._top=+b-this._bottom;this._bottom=+b-a}round(){this._left=Math.round(this._left);this._top=Math.round(this._top);this._right=Math.round(this._right);this._bottom=Math.round(this._bottom)}roundInner(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}roundOuter(){this._left=
Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}floor(){this._left=Math.floor(this._left);this._top=Math.floor(this._top);this._right=Math.floor(this._right);this._bottom=Math.floor(this._bottom)}ceil(){this._left=Math.ceil(this._left);this._top=Math.ceil(this._top);this._right=Math.ceil(this._right);this._bottom=Math.ceil(this._bottom)}clamp(b,a,d,c){this._left<b&&(this._left=+b);this._top<a&&(this._top=+a);this._right>
d&&(this._right=+d);this._bottom>c&&(this._bottom=+c)}clampFlipped(b,a,d,c){this._left<b&&(this._left=+b);this._top>a&&(this._top=+a);this._right>d&&(this._right=+d);this._bottom<c&&(this._bottom=+c)}normalize(){this._left>this._right&&this.swapLeftRight();this._top>this._bottom&&this.swapTopBottom()}intersectsRect(b){return!(b._right<this._left||b._bottom<this._top||b._left>this._right||b._top>this._bottom)}intersectsRectOffset(b,a,d){return!(b._right+a<this._left||b._bottom+d<this._top||b._left+
a>this._right||b._top+d>this._bottom)}containsPoint(b,a){return b>=this._left&&b<=this._right&&a>=this._top&&a<=this._bottom}containsRect(b){return b._left>=this._left&&b._top>=this._top&&b._right<=this._right&&b._bottom<=this._bottom}expandToContain(b){b._left<this._left&&(this._left=+b._left);b._top<this._top&&(this._top=+b._top);b._right>this._right&&(this._right=+b._right);b._bottom>this._bottom&&(this._bottom=+b._bottom)}lerpInto(b){this._left=e.lerp(b._left,b._right,this._left);this._top=e.lerp(b._top,
b._bottom,this._top);this._right=e.lerp(b._left,b._right,this._right);this._bottom=e.lerp(b._top,b._bottom,this._bottom)}}}
{"use strict";const e=self.C3;e.Quad=class{constructor(b,a,d,c,f,h,g,l){this._bly=this._blx=this._bry=this._brx=this._try=this._trx=this._tly=this._tlx=0;b instanceof e.Quad?this.copy(b):this.set(b||0,a||0,d||0,c||0,f||0,h||0,g||0,l||0)}set(b,a,d,c,f,h,g,l){this._tlx=+b;this._tly=+a;this._trx=+d;this._try=+c;this._brx=+f;this._bry=+h;this._blx=+g;this._bly=+l}setRect(b,a,d,c){this.set(b,a,d,a,d,c,b,c)}copy(b){this._tlx=b._tlx;this._tly=b._tly;this._trx=b._trx;this._try=b._try;this._brx=b._brx;this._bry=
b._bry;this._blx=b._blx;this._bly=b._bly}equals(b){return this._tlx===b._tlx&&this._tly===b._tly&&this._trx===b._trx&&this._try===b._try&&this._brx===b._brx&&this._bry===b._bry&&this._blx===b._blx&&this._bly===b._bly}setTlx(b){this._tlx=+b}getTlx(){return this._tlx}setTly(b){this._tly=+b}getTly(){return this._tly}setTrx(b){this._trx=+b}getTrx(){return this._trx}setTry(b){this._try=+b}getTry(){return this._try}setBrx(b){this._brx=+b}getBrx(){return this._brx}setBry(b){this._bry=+b}getBry(){return this._bry}setBlx(b){this._blx=
+b}getBlx(){return this._blx}setBly(b){this._bly=+b}getBly(){return this._bly}toDOMQuad(){return new DOMQuad(new DOMPoint(this._tlx,this._tly),new DOMPoint(this._trx,this._try),new DOMPoint(this._brx,this._bry),new DOMPoint(this._blx,this._bly))}toArray(){return[this._tlx,this._tly,this._trx,this._try,this._brx,this._bry,this._blx,this._bly]}toTypedArray(){return new Float64Array(this.toArray())}writeToTypedArray(b,a){b[a++]=this._tlx;b[a++]=this._tly;b[a++]=this._trx;b[a++]=this._try;b[a++]=this._brx;
b[a++]=this._bry;b[a++]=this._blx;b[a]=this._bly}writeToTypedArray3D(b,a,d){b[a++]=this._tlx;b[a++]=this._tly;b[a++]=d;b[a++]=this._trx;b[a++]=this._try;b[a++]=d;b[a++]=this._brx;b[a++]=this._bry;b[a++]=d;b[a++]=this._blx;b[a++]=this._bly;b[a]=d}offset(b,a){b=+b;a=+a;this._tlx+=b;this._tly+=a;this._trx+=b;this._try+=a;this._brx+=b;this._bry+=a;this._blx+=b;this._bly+=a}round(){this._tlx=Math.round(this._tlx);this._tly=Math.round(this._tly);this._trx=Math.round(this._trx);this._try=Math.round(this._try);
this._brx=Math.round(this._brx);this._bry=Math.round(this._bry);this._blx=Math.round(this._blx);this._bly=Math.round(this._bly)}floor(){this._tlx=Math.floor(this._tlx);this._tly=Math.floor(this._tly);this._trx=Math.floor(this._trx);this._try=Math.floor(this._try);this._brx=Math.floor(this._brx);this._bry=Math.floor(this._bry);this._blx=Math.floor(this._blx);this._bly=Math.floor(this._bly)}ceil(){this._tlx=Math.ceil(this._tlx);this._tly=Math.ceil(this._tly);this._trx=Math.ceil(this._trx);this._try=
Math.ceil(this._try);this._brx=Math.ceil(this._brx);this._bry=Math.ceil(this._bry);this._blx=Math.ceil(this._blx);this._bly=Math.ceil(this._bly)}setFromRect(b){this._tlx=b._left;this._tly=b._top;this._trx=b._right;this._try=b._top;this._brx=b._right;this._bry=b._bottom;this._blx=b._left;this._bly=b._bottom}setFromRotatedRect(b,a){0===a?this.setFromRect(b):this.setFromRotatedRectPrecalc(b,Math.sin(a),Math.cos(a))}setFromRotatedRectPrecalc(b,a,d){const c=b._left*a,f=b._top*a,h=b._right*a;a*=b._bottom;
const g=b._left*d,l=b._top*d,m=b._right*d;b=b._bottom*d;this._tlx=g-f;this._tly=l+c;this._trx=m-f;this._try=l+h;this._brx=m-a;this._bry=b+h;this._blx=g-a;this._bly=b+c}getBoundingBox(b){b.set(Math.min(this._tlx,this._trx,this._brx,this._blx),Math.min(this._tly,this._try,this._bry,this._bly),Math.max(this._tlx,this._trx,this._brx,this._blx),Math.max(this._tly,this._try,this._bry,this._bly))}containsPoint(b,a){var d=this._trx-this._tlx,c=this._try-this._tly;const f=this._brx-this._tlx,h=this._bry-this._tly;
b-=this._tlx;a-=this._tly;var g=d*d+c*c;let l=d*f+c*h;c=d*b+c*a;const m=f*f+h*h,u=f*b+h*a;let w=1/(g*m-l*l);d=(m*c-l*u)*w;g=(g*u-l*c)*w;if(0<=d&&0<g&&1>d+g)return!0;d=this._blx-this._tlx;c=this._bly-this._tly;g=d*d+c*c;l=d*f+c*h;c=d*b+c*a;w=1/(g*m-l*l);d=(m*c-l*u)*w;g=(g*u-l*c)*w;return 0<=d&&0<g&&1>d+g}midX(){return(this._tlx+this._trx+this._brx+this._blx)/4}midY(){return(this._tly+this._try+this._bry+this._bly)/4}intersectsSegment(b,a,d,c){return this.containsPoint(b,a)||this.containsPoint(d,c)?
!0:e.segmentIntersectsQuad(b,a,d,c,this)}intersectsQuad(b){var a=b.midX(),d=b.midY();if(this.containsPoint(a,d))return!0;a=this.midX();d=this.midY();if(b.containsPoint(a,d))return!0;a=this._tlx;d=this._tly;const c=this._trx,f=this._try,h=this._brx,g=this._bry,l=this._blx,m=this._bly;return e.segmentIntersectsQuad(a,d,c,f,b)||e.segmentIntersectsQuad(c,f,h,g,b)||e.segmentIntersectsQuad(h,g,l,m,b)||e.segmentIntersectsQuad(l,m,a,d,b)}rotatePointsAnticlockwise(){const b=this._tlx,a=this._tly;this._tlx=
this._trx;this._tly=this._try;this._trx=this._brx;this._try=this._bry;this._brx=this._blx;this._bry=this._bly;this._blx=b;this._bly=a}mirror(){this._swap(0,2);this._swap(1,3);this._swap(6,4);this._swap(7,5)}flip(){this._swap(0,6);this._swap(1,7);this._swap(2,4);this._swap(3,5)}diag(){this._swap(2,6);this._swap(3,7)}_swap(b,a){const d=this._getAtIndex(b);this._setAtIndex(b,this._getAtIndex(a));this._setAtIndex(a,d)}_getAtIndex(b){switch(b){case 0:return this._tlx;case 1:return this._tly;case 2:return this._trx;
case 3:return this._try;case 4:return this._brx;case 5:return this._bry;case 6:return this._blx;case 7:return this._bly;default:throw new RangeError("invalid quad point index");}}_setAtIndex(b,a){a=+a;switch(b){case 0:this._tlx=a;break;case 1:this._tly=a;break;case 2:this._trx=a;break;case 3:this._try=a;break;case 4:this._brx=a;break;case 5:this._bry=a;break;case 6:this._blx=a;break;case 7:this._bly=a;break;default:throw new RangeError("invalid quad point index");}}}}
{"use strict";const e=self.C3,b=[0,0,1,0,1,1,0,1],a=e.New(e.Quad);e.CollisionPoly=class extends e.DefendedBase{constructor(d,c=!0){super();d||(d=b);this._ptsArr=Float64Array.from(d);this._bbox=new e.Rect;this._isBboxChanged=!0;this._enabled=c}Release(){}pointsArr(){return this._ptsArr}pointCount(){return this._ptsArr.length/2}setPoints(d){this._ptsArr.length===d.length?this._ptsArr.set(d):this._ptsArr=Float64Array.from(d);this._isBboxChanged=!0}setDefaultPoints(){this.setPoints(b)}copy(d){this.setPoints(d._ptsArr)}setBboxChanged(){this._isBboxChanged=
!0}_updateBbox(){if(this._isBboxChanged){var d=this._ptsArr,c=d[0],f=d[1],h=c,g=f;for(let l=0,m=d.length;l<m;l+=2){const u=d[l],w=d[l+1];u<c&&(c=u);u>h&&(h=u);w<f&&(f=w);w>g&&(g=w)}this._bbox.set(c,f,h,g);this._isBboxChanged=!1}}setFromRect(d,c,f){let h=this._ptsArr;8!==h.length&&(this._ptsArr=h=new Float64Array(8));h[0]=d.getLeft()-c;h[1]=d.getTop()-f;h[2]=d.getRight()-c;h[3]=d.getTop()-f;h[4]=d.getRight()-c;h[5]=d.getBottom()-f;h[6]=d.getLeft()-c;h[7]=d.getBottom()-f;this._bbox.copy(d);0===c&&0===
f||this._bbox.offset(-c,-f);this._isBboxChanged=!1}setFromQuad(d,c,f){a.copy(d);a.offset(c,f);this.setPoints(a.toArray());this._isBboxChanged=!0}transform(d,c,f){let h=0,g=1;0!==f&&(h=Math.sin(f),g=Math.cos(f));this.transformPrecalc(d,c,h,g)}transformPrecalc(d,c,f,h){const g=this._ptsArr;for(let l=0,m=g.length;l<m;l+=2){const u=l+1,w=g[l]*d,q=g[u]*c;g[l]=w*h-q*f;g[u]=q*h+w*f}this._isBboxChanged=!0}offset(d,c){const f=this._ptsArr;for(let h=0,g=f.length;h<g;h+=2)f[h]+=d,f[h+1]+=c}containsPoint(d,c){const f=
this._ptsArr;if(d===f[0]&&c===f[1])return!0;this._updateBbox();var h=this._bbox;const g=h.getLeft()-110,l=h.getTop()-101,m=h.getRight()+131;h=h.getBottom()+120;let u,w,q,t,p,r,x,y;g<d?(u=g,q=d):(u=d,q=g);l<c?(w=l,t=c):(w=c,t=l);m<d?(p=m,x=d):(p=d,x=m);h<c?(r=h,y=c):(r=c,y=h);let D=0,G=0;for(let F=0,J=f.length;F<J;F+=2){var A=(F+2)%J;const B=f[F],I=f[F+1],L=f[A];A=f[A+1];e.segmentsIntersectPreCalc(g,l,d,c,u,q,w,t,B,I,L,A)&&++D;e.segmentsIntersectPreCalc(m,h,d,c,p,x,r,y,B,I,L,A)&&++G}return 1===D%2||
1===G%2}intersectsPoly(d,c,f){const h=d._ptsArr,g=this._ptsArr;if(this.containsPoint(h[0]+c,h[1]+f)||d.containsPoint(g[0]-c,g[1]-f))return!0;for(let m=0,u=g.length;m<u;m+=2){var l=(m+2)%u;d=g[m];const w=g[m+1],q=g[l];l=g[l+1];let t,p,r,x;d<q?(t=d,r=q):(t=q,r=d);w<l?(p=w,x=l):(p=l,x=w);for(let y=0,D=h.length;y<D;y+=2){const G=(y+2)%D;if(e.segmentsIntersectPreCalc(d,w,q,l,t,r,p,x,h[y]+c,h[y+1]+f,h[G]+c,h[G+1]+f))return!0}}return!1}intersectsSegment(d,c,f,h,g,l){if(this.containsPoint(f-d,h-c)||this.containsPoint(g-
d,l-c))return!0;let m,u,w,q;f<g?(m=f,w=g):(m=g,w=f);h<l?(u=h,q=l):(u=l,q=h);const t=this._ptsArr;for(let p=0,r=t.length;p<r;p+=2){const x=(p+2)%r;if(e.segmentsIntersectPreCalc(f,h,g,l,m,w,u,q,t[p]+d,t[p+1]+c,t[x]+d,t[x+1]+c))return!0}return!1}mirror(d){const c=this._ptsArr;for(let f=0,h=c.length;f<h;f+=2)c[f]=2*d-c[f];this._isBboxChanged=!0}flip(d){const c=this._ptsArr;for(let f=0,h=c.length;f<h;f+=2){const g=f+1;c[g]=2*d-c[g]}this._isBboxChanged=!0}diag(){const d=this._ptsArr;for(let c=0,f=d.length;c<
f;c+=2){const h=c+1,g=d[c];d[c]=d[h];d[h]=g}this._isBboxChanged=!0}GetMidX(){const d=this._ptsArr;let c=0;for(let f=0,h=d.length;f<h;f+=2)c+=d[f];return c/this.pointCount()}GetMidY(){const d=this._ptsArr;let c=0;for(let f=0,h=d.length;f<h;f+=2)c+=d[f+1];return c/this.pointCount()}GetPointsArray(){return this._ptsArr}GetPointCount(){return this.pointCount()}IsEnabled(){return this._enabled}}}
{"use strict";const e=self.C3;e.PairMap=class extends e.DefendedBase{constructor(b){super();this._firstMap=new Map;if(b)for(const [a,d,c]of b)this.Set(a,d,c)}Release(){this.Clear();this._firstMap=null}Clear(){const b=this._firstMap;for(const a of b.values())a.clear();b.clear()}Set(b,a,d){const c=this._firstMap;let f=c.get(b);f||(f=new Map,c.set(b,f));f.set(a,d)}Get(b,a){return(b=this._firstMap.get(b))?b.get(a):b}Has(b,a){return(b=this._firstMap.get(b))?b.has(a):!1}Delete(b,a){const d=this._firstMap,
c=d.get(b);if(!c)return!1;(a=c.delete(a))&&0===c.size&&d.delete(b);return a}DeleteEither(b){const a=this._firstMap,d=a.get(b);d&&(d.clear(),a.delete(b));for(const [c,f]of a.entries())f.delete(b)&&0===f.size&&a.delete(c)}GetSize(){let b=0;for(const a of this._firstMap.values())b+=a.size;return b}*values(){for(const b of this._firstMap.values())yield*b.values()}*keyPairs(){for(const [b,a]of this._firstMap.entries())for(const d of a.keys())yield[b,d]}*entries(){for(const [b,a]of this._firstMap.entries())for(const [d,
c]of a.entries())yield[b,d,c]}}}
{"use strict";const e=self.C3;e.ArraySet=class extends e.DefendedBase{constructor(){super();this._set=new Set;this._arr=[];this._needToRebuildArray=!1}Release(){this.Clear()}Clear(){this._set.clear();e.clearArray(this._arr);this._needToRebuildArray=!1}Add(b){this._set.has(b)||(this._set.add(b),this._needToRebuildArray||this._arr.push(b))}Has(b){return this._set.has(b)}Delete(b){this._set.delete(b)&&(this._needToRebuildArray=!0)}GetSize(){return this._set.size}IsEmpty(){return 0===this._set.size}GetArray(){this._needToRebuildArray&&
(this._RebuildArray(),this._needToRebuildArray=!1);return this._arr}_RebuildArray(){const b=this._arr;e.clearArray(b);for(const a of this._set)b.push(a)}}}
{"use strict";const e=new Map,b=new Map,a=new Map,d=new Map,c=new Map,f=new Map;f.set("linear","noease");f.set("default","noease");self.Ease=class q{constructor(){}static InheritEase(){return"default"}static DefaultEase(){return"noease"}static GetEditorEaseNames(t,...p){this._CreateEaseMap();a.has(t)||a.set(t,new Map);t=[...a.get(t).keys()];t.sort();return[...b.keys()].concat(t).filter(r=>!p.includes(r))}static GetRuntimeEaseNames(){this._CreateEaseMap();const t=[...d.keys()];t.sort();return[...b.keys()].concat(t)}static IsNamePredefined(t){this._CreateEaseMap();
return[...b.keys()].includes(t)}static _GetEase(t){const p=f.get(t);if(p)return e.get(p);if(q.IsNamePredefined(t))return e.get(t);if(c.has(t))return c.get(t)}static GetEditorEase(t,p){this._CreateEaseMap();const r=q._GetEase(t);return r?r:a.get(p).get(t)}static GetRuntimeEase(t){this._CreateEaseMap();const p=q._GetEase(t);return p?p:d.get(t)}static GetEaseFromIndex(t){this._CreateEaseMap();return this.GetRuntimeEaseNames()[t]}static GetIndexForEase(t,p){this._CreateEaseMap();return this.GetEditorEaseNames(p).indexOf(t)}static _CreateEaseMap(){0===
e.size&&(this._AddPredifinedEase("default",()=>{}),this._AddPredifinedEase("noease",this.NoEase),this._AddPredifinedEase("easeinsine",this.EaseInSine),this._AddPredifinedEase("easeoutsine",this.EaseOutSine),this._AddPredifinedEase("easeinoutsine",this.EaseInOutSine),this._AddPredifinedEase("easeinelastic",this.EaseInElastic),this._AddPredifinedEase("easeoutelastic",this.EaseOutElastic),this._AddPredifinedEase("easeinoutelastic",this.EaseInOutElastic),this._AddPredifinedEase("easeinback",this.EaseInBack),
this._AddPredifinedEase("easeoutback",this.EaseOutBack),this._AddPredifinedEase("easeinoutback",this.EaseInOutBack),this._AddPredifinedEase("easeinbounce",this.EaseInBounce),this._AddPredifinedEase("easeoutbounce",this.EaseOutBounce),this._AddPredifinedEase("easeinoutbounce",this.EaseInOutBounce),this._AddPredifinedEase("easeincubic",this.EaseInCubic),this._AddPredifinedEase("easeoutcubic",this.EaseOutCubic),this._AddPredifinedEase("easeinoutcubic",this.EaseInOutCubic),this._AddPredifinedEase("easeinquad",
this.EaseInQuad),this._AddPredifinedEase("easeoutquad",this.EaseOutQuad),this._AddPredifinedEase("easeinoutquad",this.EaseInOutQuad),this._AddPredifinedEase("easeinquart",this.EaseInQuart),this._AddPredifinedEase("easeoutquart",this.EaseOutQuart),this._AddPredifinedEase("easeinoutquart",this.EaseInOutQuart),this._AddPredifinedEase("easeinquint",this.EaseInQuint),this._AddPredifinedEase("easeoutquint",this.EaseOutQuint),this._AddPredifinedEase("easeinoutquint",this.EaseInOutQuint),this._AddPredifinedEase("easeincirc",
this.EaseInCirc),this._AddPredifinedEase("easeoutcirc",this.EaseOutCirc),this._AddPredifinedEase("easeinoutcirc",this.EaseInOutCirc),this._AddPredifinedEase("easeinexpo",this.EaseInExpo),this._AddPredifinedEase("easeoutexpo",this.EaseOutExpo),this._AddPredifinedEase("easeinoutexpo",this.EaseInOutExpo),this._AddPrivateCustomEase("cubicbezier",this.EaseCubicBezier),this._AddPrivateCustomEase("spline",this.EaseSpline))}static _AddPredifinedEase(t,p){q._AddEase(t,p,"predefined")}static _AddPrivateCustomEase(t,
p){q._AddEase(t,p,"private")}static AddCustomEase(t,p,r){this._CreateEaseMap();q._AddEase(t,p,"custom",r)}static RemoveCustomEase(t,p){this.IsNamePredefined(t)||[...c.keys()].includes(t)||(p=a.get(p))&&p.delete(t)}static _AddEase(t,p,r,x){switch(r){case "predefined":e.set(t,p);b.set(t,p);break;case "custom":x?(a.has(x)||a.set(x,new Map),a.get(x).set(t,p)):d.set(t,p);break;case "private":e.set(t,p);c.set(t,p);break;default:throw Error("unexpected ease mode");}}static NoEase(t,p,r,x){return r*t/x+p}static EaseInQuad(t,
p,r,x){return r*(t/=x)*t+p}static EaseOutQuad(t,p,r,x){return-r*(t/=x)*(t-2)+p}static EaseInOutQuad(t,p,r,x){return 1>(t/=x/2)?r/2*t*t+p:-r/2*(--t*(t-2)-1)+p}static EaseInCubic(t,p,r,x){return r*(t/=x)*t*t+p}static EaseOutCubic(t,p,r,x){return r*((t=t/x-1)*t*t+1)+p}static EaseInOutCubic(t,p,r,x){return 1>(t/=x/2)?r/2*t*t*t+p:r/2*((t-=2)*t*t+2)+p}static EaseInQuart(t,p,r,x){return r*(t/=x)*t*t*t+p}static EaseOutQuart(t,p,r,x){return-r*((t=t/x-1)*t*t*t-1)+p}static EaseInOutQuart(t,p,r,x){return 1>(t/=
x/2)?r/2*t*t*t*t+p:-r/2*((t-=2)*t*t*t-2)+p}static EaseInQuint(t,p,r,x){return r*(t/=x)*t*t*t*t+p}static EaseOutQuint(t,p,r,x){return r*((t=t/x-1)*t*t*t*t+1)+p}static EaseInOutQuint(t,p,r,x){return 1>(t/=x/2)?r/2*t*t*t*t*t+p:r/2*((t-=2)*t*t*t*t+2)+p}static EaseInSine(t,p,r,x){return-r*Math.cos(t/x*(Math.PI/2))+r+p}static EaseOutSine(t,p,r,x){return r*Math.sin(t/x*(Math.PI/2))+p}static EaseInOutSine(t,p,r,x){return-r/2*(Math.cos(Math.PI*t/x)-1)+p}static EaseInExpo(t,p,r,x){return 0===t?p:r*Math.pow(2,
10*(t/x-1))+p}static EaseOutExpo(t,p,r,x){return t===x?p+r:r*(-Math.pow(2,-10*t/x)+1)+p}static EaseInOutExpo(t,p,r,x){return 0===t?p:t===x?p+r:1>(t/=x/2)?r/2*Math.pow(2,10*(t-1))+p:r/2*(-Math.pow(2,-10*--t)+2)+p}static EaseInCirc(t,p,r,x){return-r*(Math.sqrt(1-(t/=x)*t)-1)+p}static EaseOutCirc(t,p,r,x){return r*Math.sqrt(1-(t=t/x-1)*t)+p}static EaseInOutCirc(t,p,r,x){return 1>(t/=x/2)?-r/2*(Math.sqrt(1-t*t)-1)+p:r/2*(Math.sqrt(1-(t-=2)*t)+1)+p}static EaseInElastic(t,p,r,x){let y=0,D=r;if(0===t)return p;
if(1===(t/=x))return p+r;y||(y=.3*x);D<Math.abs(r)?(D=r,r=y/4):r=y/(2*Math.PI)*Math.asin(r/D);return-(D*Math.pow(2,10*--t)*Math.sin(2*(t*x-r)*Math.PI/y))+p}static EaseOutElastic(t,p,r,x){let y,D=0,G=r;if(0===t)return p;if(1===(t/=x))return p+r;D||(D=.3*x);G<Math.abs(r)?(G=r,y=D/4):y=D/(2*Math.PI)*Math.asin(r/G);return G*Math.pow(2,-10*t)*Math.sin(2*(t*x-y)*Math.PI/D)+r+p}static EaseInOutElastic(t,p,r,x){let y,D=0,G=r;if(0===t)return p;if(2===(t/=x/2))return p+r;D||(D=.3*x*1.5);G<Math.abs(r)?(G=r,
y=D/4):y=D/(2*Math.PI)*Math.asin(r/G);return 1>t?-.5*G*Math.pow(2,10*--t)*Math.sin(2*(t*x-y)*Math.PI/D)+p:G*Math.pow(2,-10*--t)*Math.sin(2*(t*x-y)*Math.PI/D)*.5+r+p}static EaseInBack(t,p,r,x,y){void 0===y&&(y=1.70158);return r*(t/=x)*t*((y+1)*t-y)+p}static EaseOutBack(t,p,r,x,y){void 0===y&&(y=1.70158);return r*((t=t/x-1)*t*((y+1)*t+y)+1)+p}static EaseInOutBack(t,p,r,x,y){void 0===y&&(y=1.70158);return 1>(t/=x/2)?r/2*t*t*(((y*=1.525)+1)*t-y)+p:r/2*((t-=2)*t*(((y*=1.525)+1)*t+y)+2)+p}static EaseInBounce(t,
p,r,x){return r-q.EaseOutBounce(x-t,0,r,x)+p}static EaseOutBounce(t,p,r,x){return(t/=x)<1/2.75?7.5625*r*t*t+p:t<2/2.75?r*(7.5625*(t-=1.5/2.75)*t+.75)+p:t<2.5/2.75?r*(7.5625*(t-=2.25/2.75)*t+.9375)+p:r*(7.5625*(t-=2.625/2.75)*t+.984375)+p}static EaseInOutBounce(t,p,r,x){return t<x/2?.5*q.EaseInBounce(2*t,0,r,x)+p:.5*q.EaseOutBounce(2*t-x,0,r,x)+.5*r+p}static EaseCubicBezier(t,p,r,x,y){return p+3*t*(r-p)+3*t**2*(p+x-2*r)+t**3*(y-p+3*r-3*x)}static EaseSpline(t,p,r,x,y,D,G,A,F,J){if(x===y&&D===G)return t;
t=w(t,p,x,D,A,J);p=h(r,y,G,F);x=g(r,y,G,F);r=l(r,y,G,F);return m(t,p,x,r)}static GetBezierSamples(t,p,r,x){const y=[],D=h(t,p,r,x),G=g(t,p,r,x);t=l(t,p,r,x);for(p=0;11>p;++p)r=m(.1*p,D,G,t),y.push(r);return y}};const h=(q,t,p,r)=>r-3*p+3*t-q,g=(q,t,p,r)=>3*p-6*t+3*q,l=(q,t,p,r)=>3*(t-q),m=(q,t,p,r)=>((t*q+p)*q+r)*q,u=(q,t,p,r)=>3*t*q*q+2*p*q+r,w=(q,t,p,r,x,y)=>{if(1==q)return 1;for(var D=0,G=1,A=y[G];10!=G&&A<=q;)G++,A=y[G],D+=.1;G--;A=y[G];y=D+(q-A)/(y[G+1]-A)*.1;G=h(t,p,r,x);A=g(t,p,r,x);t=l(t,
p,r,x);p=u(y,G,A,t);if(0!==p)if(.02<=p)for(D=0;4>D;++D)p=m(y,G,A,t)-q,r=u(y,G,A,t),y-=p/r;else{p=D;D+=.1;r=0;let F;do y=p+(D-p)/2,x=m(y,G,A,t)-q,0<x?D=y:p=y,x=1E-7<Math.abs(x),F=10>++r;while(x&&F)}return y}}
{"use strict";const e=self.C3;function b(a){e.IsString(a)}e.ProbabilityTable=class{constructor(){this._items=[];this._totalWeight=0}Release(){this.Clear();this._items=null}Clear(){e.clear2DArray(this._items);this._totalWeight=0}GetTotalWeight(){return this._totalWeight}Sample(a=Math.random()*this.GetTotalWeight()){let d=0;for(const [c,f]of this._items)if(d+=c,a<d)return f;return 0}AddItem(a,d){b(d);this._totalWeight+=a;this._items.push([a,d])}RemoveItem(a,d){b(d);const c=0===a;for(let f=0;f<this._items.length;f++){const h=
this._items[f],g=h[1]===d;if((c||h[0]===a)&&g){this._items.splice(f,1);this._totalWeight-=h[0];break}}}asJSON(){return JSON.stringify(this._items)}static fromJSON(a){const d=new e.ProbabilityTable;a=JSON.parse(a);for(const c of a)d.AddItem(c[0],c[1]);return d}}}"use strict";
self.C3.Event=class{constructor(e,b){this.type=e;this.cancelable=!!b;this.isAsync=this.propagationStopped=this.defaultPrevented=!1}preventDefault(){if(!this.cancelable)throw Error(`event '${this.type}' is not cancelable`);this.defaultPrevented=!0}stopPropagation(){if(!this.cancelable)throw Error(`event '${this.type}' cannot be stopped`);if(this.isAsync)throw Error(`cannot stop async event '${this.type}' propagation`);this.propagationStopped=!0}};
{"use strict";const e=self.C3;e.Event.Handler=class extends e.DefendedBase{constructor(b){super();this._type=b;this._captureListeners=[];this._captureListenersSet=new Set;this._listeners=[];this._listenersSet=new Set;this._fireDepth=0;this._queueModifyListeners=[]}Release(){0<this._fireDepth||(e.clearArray(this._captureListeners),this._captureListenersSet.clear(),e.clearArray(this._listeners),this._listenersSet.clear(),e.clearArray(this._queueModifyListeners),e.Release(this))}_AddListener(b,a){this._IsFiring()?
this._queueModifyListeners.push({op:"add",func:b,capture:a}):a?this._captureListenersSet.has(b)||(this._captureListeners.push(b),this._captureListenersSet.add(b)):this._listenersSet.has(b)||(this._listeners.push(b),this._listenersSet.add(b))}_RemoveListener(b,a){this._IsFiring()?this._queueModifyListeners.push({op:"remove",func:b,capture:a}):a?this._captureListenersSet.has(b)&&(this._captureListenersSet.delete(b),e.arrayFindRemove(this._captureListeners,b)):this._listenersSet.has(b)&&(this._listenersSet.delete(b),
e.arrayFindRemove(this._listeners,b))}_IsEmpty(){return!this._captureListeners.length&&!this._listeners.length}_IsFiring(){return 0<this._fireDepth}_ProcessQueuedListeners(){const b=new Set,a=new Set;for(const d of this._queueModifyListeners)if("add"===d.op)this._AddListener(d.func,d.capture),d.capture?a.delete(d.func):b.delete(d.func);else if("remove"===d.op)d.capture?(this._captureListenersSet.delete(d.func),a.add(d.func)):(this._listenersSet.delete(d.func),b.add(d.func));else throw Error("invalid op");
e.arrayRemoveAllInSet(this._listeners,b);e.arrayRemoveAllInSet(this._captureListeners,a);e.clearArray(this._queueModifyListeners)}_FireCancellable(b){this._IncreaseFireDepth();let a=!1;for(let d=0,c=this._captureListeners.length;d<c;++d)if(this._captureListeners[d](b),b.propagationStopped){a=!0;break}if(!a)for(let d=0,c=this._listeners.length;d<c&&(this._listeners[d](b),!b.propagationStopped);++d);this._DecreaseFireDepth();return!b.defaultPrevented}_FireNonCancellable(b){this._IncreaseFireDepth();
for(let a=0,d=this._captureListeners.length;a<d;++a)this._captureListeners[a](b);for(let a=0,d=this._listeners.length;a<d;++a)this._listeners[a](b);this._DecreaseFireDepth();return!0}_IncreaseFireDepth(){this._fireDepth++}_DecreaseFireDepth(){this._fireDepth--;0===this._fireDepth&&0<this._queueModifyListeners.length&&this._ProcessQueuedListeners()}SetDelayRemoveEventsEnabled(b){b?this._IncreaseFireDepth():this._DecreaseFireDepth()}_FireAsync(b){let a=[];for(let d=0,c=this._captureListeners.length;d<
c;++d){let f=this._captureListeners[d];a.push(e.Asyncify(()=>f(b)))}for(let d=0,c=this._listeners.length;d<c;++d){let f=this._listeners[d];a.push(e.Asyncify(()=>f(b)))}return Promise.all(a).then(()=>!b.defaultPrevented)}_FireAndWait_AsyncOptional(b){const a=[];this._IncreaseFireDepth();for(let c=0,f=this._captureListeners.length;c<f;++c){var d=this._captureListeners[c](b);d instanceof Promise&&a.push(d)}for(let c=0,f=this._listeners.length;c<f;++c)d=this._listeners[c](b),d instanceof Promise&&a.push(d);
this._DecreaseFireDepth();return a.length?Promise.all(a).then(()=>!b.defaultPrevented):!b.defaultPrevented}async _FireAndWaitAsync(b){return await this._FireAndWait_AsyncOptional(b)}async _FireAndWaitAsyncSequential(b){this._IncreaseFireDepth();for(let d=0,c=this._captureListeners.length;d<c;++d){var a=this._captureListeners[d](b);a instanceof Promise&&await a}for(let d=0,c=this._listeners.length;d<c;++d)a=this._listeners[d](b),a instanceof Promise&&await a;this._DecreaseFireDepth();return!b.defaultPrevented}*_FireAsGenerator(b){this._IncreaseFireDepth();
for(let d=0,c=this._captureListeners.length;d<c;++d){var a=this._captureListeners[d](b);e.IsIterator(a)&&(yield*a)}for(let d=0,c=this._listeners.length;d<c;++d)a=this._listeners[d](b),e.IsIterator(a)&&(yield*a);this._DecreaseFireDepth()}}}
{"use strict";const e=self.C3;e.Event.Dispatcher=class extends e.DefendedBase{constructor(){super();this._eventHandlers=new Map;this._dispatcherWasReleased=!1}Release(){if(this._dispatcherWasReleased)throw Error("already released");this.ClearEvents();this._dispatcherWasReleased=!0;e.Release(this)}WasReleased(){return this._dispatcherWasReleased}ClearEvents(){for(let b of this._eventHandlers.values())b.Release();this._eventHandlers.clear()}_GetHandlerByType(b,a){let d=this._eventHandlers.get(b);return d?
d:a?(d=e.New(e.Event.Handler,b),this._eventHandlers.set(b,d),d):null}HasAnyHandlerFor(b){return this._eventHandlers.has(b)}addEventListener(b,a,d){this._GetHandlerByType(b,!0)._AddListener(a,!!d)}removeEventListener(b,a,d){let c=this._GetHandlerByType(b,!1);c&&(c._RemoveListener(a,!!d),c._IsEmpty()&&this._eventHandlers.delete(b))}dispatchEvent(b){const a=this._GetHandlerByType(b.type,!1);return a?b.cancelable?a._FireCancellable(b):a._FireNonCancellable(b):!0}dispatchEventAsync(b){const a=this._GetHandlerByType(b.type,
!1);if(!a)return Promise.resolve(!0);b.isAsync=!0;return a._FireAsync(b)}async dispatchEventAndClearAsync(b){const a=this._GetHandlerByType(b.type,!1);if(!a)return!0;this._eventHandlers.delete(b.type);b.isAsync=!0;b=await a._FireAsync(b);a.Release();return b}async dispatchEventAndWaitAsync(b){const a=this._GetHandlerByType(b.type,!1);return a?await a._FireAndWaitAsync(b):!0}dispatchEventAndWait_AsyncOptional(b){const a=this._GetHandlerByType(b.type,!1);return a?a._FireAndWait_AsyncOptional(b):!0}async dispatchEventAndWaitAsyncSequential(b){const a=
this._GetHandlerByType(b.type,!1);return a?await a._FireAndWaitAsyncSequential(b):!0}dispatchGeneratorEvent(b){const a=this._GetHandlerByType(b.type,!1);if(!a)return null;if(b.cancelable)throw Error("not supported");return a._FireAsGenerator(b)}SetDelayRemoveEventsEnabled(b){for(const a of this._eventHandlers.values())a.SetDelayRemoveEventsEnabled(b)}}}
{"use strict";const e=self.C3,b="undefined"!==typeof requestIdleCallback;let a=[],d=-1,c=0;function f(m){d=b&&0===c?requestIdleCallback(h,{timeout:35}):setTimeout(h,0<c?1:m)}function h(m){d=-1;if(a.length){var u=performance.now(),w=0;do{g(a.shift());var q=performance.now();++w;var t=(q-u)/w*1.1}while(a.length&&(b&&0===c&&"undefined"!==typeof m?t<m.timeRemaining():12>q-u+t));-1===d&&a.length&&f(Math.max(16-(q-u),4))}}function g(m){let u;try{u=m.func()}catch(w){m.reject(w);return}m.resolve(u)}let l=
e.QueryString.Has("disable-asyncify");l&&console.warn("[Asyncify] Asyncify has been disabled due to disable-asyncify in the query string. Some work will now be done synchronously.");e.Asyncify=function(m){let u=null;e.isDebug&&(u=e.GetCallStack());return new Promise((w,q)=>{a.push({func:m,resolve:w,reject:q,stack:u});l?g(a.pop()):-1===d&&f(16)})};e.Asyncify.SetHighThroughputMode=function(m){if(m)++c;else if(--c,0>c)throw Error("already turned off high throughput mode");}}
{"use strict";const e=self.C3;let b=-1;function a(){b=-1}e.FastGetDateNow=function(){-1===b&&(b=Date.now(),self.setTimeout(a,16));return b};let d=-1,c=-1,f=new Set;function h(){c=d=-1;let g=Date.now();for(let l of f)if(l._CheckTimeout(g)){let m=l._GetDeadline();if(-1===c||m<c)c=m}else f.delete(l);-1!==c&&(d=self.setTimeout(h,Math.max(c-g+100,1E3)))}e.IdleTimeout=class{constructor(g,l){this._callback=g;this._timeout=1E3*l;this._deadline=0;this._isActive=!1}Reset(){let g=e.FastGetDateNow();this._deadline=
g+this._timeout;this._isActive||(f.add(this),this._isActive=!0);-1===d?(c=this._deadline,d=self.setTimeout(h,this._timeout+100)):this._deadline<c&&c>g+1E3&&(self.clearTimeout(d),c=this._deadline,d=self.setTimeout(h,this._timeout+100))}_CheckTimeout(g){return g>=this._deadline?this._callback()?(this._deadline=g+this._timeout,!0):this._isActive=!1:!0}_GetDeadline(){return this._deadline}Cancel(){this._isActive&&(f.delete(this),this._isActive=!1,0===f.size&&-1!==d&&(self.clearTimeout(d),c=d=-1))}Release(){this.Cancel();
this._callback=null}}}
{"use strict";const e=self.C3;e.Disposable=class b{constructor(a){this._disposed=!1;this._disposeAction=a}Dispose(){this._disposed||(this._disposed=!0,this._disposeAction&&(this._disposeAction(),this._disposeAction=null))}IsDisposed(){return this._disposed}Release(){this.Dispose()}static Release(a){return new b(()=>a.Release())}static From(a,d,c,f,h){if("undefined"===typeof f||null===f)f=!1;else if("boolean"!==typeof f&&"object"!==typeof f)throw new TypeError("invalid event listener options");h&&
(c=c.bind(h));if(d.includes(" ")){d=d.split(" ");h=new e.CompositeDisposable;for(let g of d)a.addEventListener(g,c,f),h.Add(e.New(e.Disposable,()=>a.removeEventListener(g,c,f)));return h}a.addEventListener(d,c,f);return e.New(e.Disposable,()=>a.removeEventListener(d,c,f))}};e.StubDisposable=class extends e.Disposable{SetAction(b){this._disposeAction=b}};e.CompositeDisposable=class extends e.Disposable{constructor(...b){super();this._disposables=new Set;for(let a of b)this.Add(a)}Add(...b){if(this._disposed)throw Error("already disposed");
for(let a of b)this._disposables.add(a)}Remove(b){if(this._disposed)throw Error("already disposed");this._disposables.delete(b)}RemoveAll(){if(this._disposed)throw Error("already disposed");if(this._disposables){for(let b of this._disposables)b.Dispose();this._disposables.clear()}}IsDisposed(){return this._disposed}Dispose(){if(this._disposed)throw Error("already disposed");this._disposed=!0;for(let b of this._disposables)b.Dispose();this._disposables.clear();this._disposables=null}Release(){this.Dispose()}}}
{"use strict";const e=self.C3;e.KahanSum=class extends e.DefendedBase{constructor(){super();this._sum=this._t=this._y=this._c=0}Add(b){this._y=+b-this._c;this._t=this._sum+this._y;this._c=this._t-this._sum-this._y;this._sum=this._t}Subtract(b){this._sum-=+b}Get(){return this._sum}Reset(){this._sum=this._t=this._y=this._c=0}Set(b){this._t=this._y=this._c=0;this._sum=+b}Release(){}}}
{"use strict";const e=self.C3,b={RBnode:function(a){this.tree=a;this.left=this.right=this.tree.sentinel;this.parent=null;this.color=!1;this.key=null},RedBlackSet:function(a){this.size=0;this.sentinel=new b.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel;this.compare=a||this.default_compare}};b.RedBlackSet.prototype.default_compare=function(a,d){return a<d?-1:d<a?1:0};b.RedBlackSet.prototype.clone=function(){var a=new b.RedBlackSet(this.compare);a.insertAll(this);
return a};b.RedBlackSet.prototype.clear=function(){this.size=0;this.sentinel=new b.RBnode(this);this.sentinel.color=!1;this.root=this.sentinel;this.root.parent=this.sentinel};b.RedBlackSet.prototype.leftRotate=function(a){var d=a.right;a.right=d.left;d.left!=this.sentinel&&(d.left.parent=a);d.parent=a.parent;a.parent==this.sentinel?this.root=d:a==a.parent.left?a.parent.left=d:a.parent.right=d;d.left=a;a.parent=d};b.RedBlackSet.prototype.rightRotate=function(a){var d=a.left;a.left=d.right;d.right!=
this.sentinel&&(d.right.parent=a);d.parent=a.parent;a.parent==this.sentinel?this.root=d:a==a.parent.right?a.parent.right=d:a.parent.left=d;d.right=a;a.parent=d};b.RedBlackSet.prototype.insert=function(a){if(this.contains(a))this.get_(a).key=a;else{var d=new b.RBnode(this);d.key=a;a=this.sentinel;for(var c=this.root;c!=this.sentinel;)a=c,c=0>this.compare(d.key,c.key)?c.left:c.right;d.parent=a;a==this.sentinel?this.root=d:0>this.compare(d.key,a.key)?a.left=d:a.right=d;d.left=this.sentinel;d.right=this.sentinel;
d.color=!0;this.insertFixup(d);this.size++}};b.RedBlackSet.prototype.insertFixup=function(a){for(;a!=this.sentinel&&a!=this.root&&1==a.parent.color;)if(a.parent==a.parent.parent.left){var d=a.parent.parent.right;1==d.color?(a.parent.color=!1,d.color=!1,a.parent.parent.color=!0,a=a.parent.parent):(a==a.parent.right&&(a=a.parent,this.leftRotate(a)),a.parent.color=!1,a.parent.parent.color=!0,a.parent.parent!=this.sentinel&&this.rightRotate(a.parent.parent))}else d=a.parent.parent.left,1==d.color?(a.parent.color=
!1,d.color=!1,a.parent.parent.color=!0,a=a.parent.parent):(a==a.parent.left&&(a=a.parent,this.rightRotate(a)),a.parent.color=!1,a.parent.parent.color=!0,a.parent.parent!=this.sentinel&&this.leftRotate(a.parent.parent));this.root.color=!1};b.RedBlackSet.prototype.delete_=function(a){var d=a.left==this.sentinel||a.right==this.sentinel?a:this.successor_(a);var c=d.left!=this.sentinel?d.left:d.right;c.parent=d.parent;d.parent==this.sentinel?this.root=c:d==d.parent.left?d.parent.left=c:d.parent.right=
c;d!=a&&(a.key=d.key);0==d.color&&this.deleteFixup(c);this.size--};b.RedBlackSet.prototype.deleteFixup=function(a){for(;a!=this.root&&0==a.color;)if(a==a.parent.left){var d=a.parent.right;1==d.color&&(d.color=!1,a.parent.color=!0,this.leftRotate(a.parent),d=a.parent.right);0==d.left.color&&0==d.right.color?(d.color=!0,a=a.parent):(0==d.right.color&&(d.left.color=!1,d.color=!0,this.rightRotate(d),d=a.parent.right),d.color=a.parent.color,a.parent.color=!1,d.right.color=!1,this.leftRotate(a.parent),
a=this.root)}else d=a.parent.left,1==d.color&&(d.color=!1,a.parent.color=!0,this.rightRotate(a.parent),d=a.parent.left),0==d.right.color&&0==d.left.color?(d.color=!0,a=a.parent):(0==d.left.color&&(d.right.color=!1,d.color=!0,this.leftRotate(d),d=a.parent.left),d.color=a.parent.color,a.parent.color=!1,d.left.color=!1,this.rightRotate(a.parent),a=this.root);a.color=!1};b.RedBlackSet.prototype.remove=function(a){a=this.get_(a);if(a!=this.sentinel){var d=a.key;this.delete_(a);return d}return null};b.RedBlackSet.prototype.removeSwapped=
function(a,d){this.remove(d)};b.RedBlackSet.prototype.min=function(a){for(;a.left!=this.sentinel;)a=a.left;return a};b.RedBlackSet.prototype.max=function(a){for(;a.right!=this.sentinel;)a=a.right;return a};b.RedBlackSet.prototype.successor_=function(a){if(a.right!=this.sentinel)return this.min(a.right);for(var d=a.parent;d!=this.sentinel&&a==d.right;)a=d,d=d.parent;return d};b.RedBlackSet.prototype.predeccessor_=function(a){if(a.left!=this.sentinel)return this.max(a.left);for(var d=a.parent;d!=this.sentinel&&
a==d.left;)a=d,d=d.parent;return d};b.RedBlackSet.prototype.successor=function(a){if(0<this.size){a=this.get_(a);if(a==this.sentinel)return null;if(a.right!=this.sentinel)return this.min(a.right).key;for(var d=a.parent;d!=this.sentinel&&a==d.right;)a=d,d=d.parent;return d!=this.sentinel?d.key:null}return null};b.RedBlackSet.prototype.predecessor=function(a){if(0<this.size){a=this.get_(a);if(a==this.sentinel)return null;if(a.left!=this.sentinel)return this.max(a.left).key;for(var d=a.parent;d!=this.sentinel&&
a==d.left;)a=d,d=d.parent;return d!=this.sentinel?d.key:null}return null};b.RedBlackSet.prototype.getMin=function(){return this.min(this.root).key};b.RedBlackSet.prototype.getMax=function(){return this.max(this.root).key};b.RedBlackSet.prototype.get_=function(a){for(var d=this.root;d!=this.sentinel&&0!=this.compare(d.key,a);)d=0>this.compare(a,d.key)?d.left:d.right;return d};b.RedBlackSet.prototype.contains=function(a){return null!=this.get_(a).key};b.RedBlackSet.prototype.getValues=function(){var a=
[];this.forEach(function(d){a.push(d)});return a};b.RedBlackSet.prototype.insertAll=function(a){if("array"==b.typeOf(a))for(var d=0;d<a.length;d++)this.insert(a[d]);else if("function"==b.typeOf(a.forEach))a.forEach(this.insert,this);else if("function"==b.typeOf(a.getValues))for(a=a.getValues(),d=0;d<a.length;d++)this.insert(a[d]);else if("object"==b.typeOf(a))for(d in a)this.insert(a[d])};b.RedBlackSet.prototype.removeAll=function(a){if("array"==b.typeOf(a))for(var d=0;d<a.length;d++)this.remove(a[d]);
else if("function"==b.typeOf(a.forEach))a.forEach(this.removeSwapped,this);else if("function"==b.typeOf(a.getValues))for(a=a.getValues(),d=0;d<a.length;d++)this.remove(a[d]);else if("object"==b.typeOf(a))for(d in a)this.remove(a[d])};b.RedBlackSet.prototype.containsAll=function(a){if("array"==b.typeOf(a)){for(var d=0;d<a.length;d++)if(!this.contains(a[d]))return!1;return!0}if("function"==b.typeOf(a.forEach))return a.every(this.contains,this);if("function"==b.typeOf(a.getValues)){a=a.getValues();for(d=
0;d<a.length;d++)if(!this.contains(a[d]))return!1;return!0}if("object"==b.typeOf(a)){for(d in a)if(!this.contains(a[d]))return!1;return!0}};b.RedBlackSet.prototype.range=function(a,d){var c=[];this.traverseFromTo(function(f){c.push(f)},a,d);return c};b.RedBlackSet.prototype.traverse=function(a,d){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel&&!a.call(d,c.key,this);)c=this.successor_(c)};b.RedBlackSet.prototype.traverseFrom=function(a,d,c){if(!this.isEmpty())for(d=this.get_(d);d!=
this.sentinel&&!a.call(c,d.key,this);)d=this.successor_(d)};b.RedBlackSet.prototype.traverseTo=function(a,d,c){if(!this.isEmpty()){var f=this.min(this.root);for(d=this.get_(d);f!=d&&!a.call(c,f.key,this);)f=this.successor_(f)}};b.RedBlackSet.prototype.traverseFromTo=function(a,d,c,f){if(!this.isEmpty())for(d=this.get_(d),c=this.get_(c);d!=c&&!a.call(f,d.key,this);)d=this.successor_(d)};b.RedBlackSet.prototype.traverseBackwards=function(a,d){if(!this.isEmpty())for(var c=this.max(this.root);c!=this.sentinel&&
!a.call(d,c.key,this);)c=this.predeccessor_(c)};b.RedBlackSet.prototype.forEach=function(a,d){if(!this.isEmpty())for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))a.call(d,c.key,c.key,this)};b.RedBlackSet.prototype.some=function(a,d){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))if(a.call(d,c.key,c.key,this))return!0;return!1};b.RedBlackSet.prototype.every=function(a,d){if(this.isEmpty())return!1;for(var c=this.min(this.root);c!=this.sentinel;c=
this.successor_(c))if(!a.call(d,c.key,c.key,this))return!1;return!0};b.RedBlackSet.prototype.map=function(a,d){var c=[];if(this.isEmpty())return c;for(var f=this.min(this.root);f!=this.sentinel;f=this.successor_(f))c.push(a.call(d,f.key,f.key,this));return c};b.RedBlackSet.prototype.filter=function(a,d){var c=[];if(this.isEmpty())return c;for(var f=this.min(this.root);f!=this.sentinel;f=this.successor_(f))a.call(d,f.key,f.key,this)&&c.push(f.key);return c};b.RedBlackSet.prototype.getCount=function(){return this.size};
b.RedBlackSet.prototype.isEmpty=function(){return 0==this.size};b.RedBlackSet.prototype.isSubsetOf=function(a){var d=b.getCount(a);if(this.getCount()>d)return!1;d=0;if(this.isEmpty())return!0;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))b.contains.call(a,a,c.key)&&d++;return d==this.getCount()};b.RedBlackSet.prototype.intersection=function(a){var d=new b.RedBlackSet(this.compare);if(this.isEmpty())return d;for(var c=this.min(this.root);c!=this.sentinel;c=this.successor_(c))a.contains.call(a,
c.key,c.key,this)&&d.insert(c.key);return d};e.RedBlackSet=class extends e.DefendedBase{constructor(a){super();this._rbSet=new b.RedBlackSet(a);this._enableQueue=!1;this._queueInsert=new Set;this._queueRemove=new Set}Add(a){this._enableQueue?this._rbSet.contains(a)?this._queueRemove.delete(a):this._queueInsert.add(a):this._rbSet.insert(a)}Remove(a){this._enableQueue?this._rbSet.contains(a)?this._queueRemove.add(a):this._queueInsert.delete(a):this._rbSet.remove(a)}Has(a){return this._enableQueue?this._queueInsert.has(a)?
!0:!this._queueRemove.has(a)&&this._rbSet.contains(a):this._rbSet.contains(a)}Clear(){this._rbSet.clear();this._queueInsert.clear();this._queueRemove.clear()}toArray(){if(this._enableQueue)throw Error("cannot be used in queueing mode");return this._rbSet.getValues()}GetSize(){return this._rbSet.getCount()+this._queueInsert.size-this._queueRemove.size}IsEmpty(){return 0===this.GetSize()}Front(){if(this.IsEmpty())throw Error("empty set");if(this._enableQueue)throw Error("cannot be used in queueing mode");
const a=this._rbSet;return a.min(a.root).key}Shift(){if(this.IsEmpty())throw Error("empty set");if(this._enableQueue)throw Error("cannot be used in queueing mode");const a=this.Front();this.Remove(a);return a}SetQueueingEnabled(a){a=!!a;if(this._enableQueue!==a&&(this._enableQueue=a,!a)){for(const d of this._queueRemove)this._rbSet.remove(d);this._queueRemove.clear();for(const d of this._queueInsert)this._rbSet.insert(d);this._queueInsert.clear()}}ForEach(a){this._rbSet.forEach(a)}*values(){if(!this.IsEmpty()){var a=
this._rbSet;for(let d=a.min(a.root);d!=a.sentinel;d=a.successor_(d))yield d.key}}[Symbol.iterator](){return this.values()}}}
{"use strict";const e=self.C3;e.PromiseThrottle=class{constructor(b=e.hardwareConcurrency){this._maxParallel=b;this._queue=[];this._activeCount=0}Add(b){return new Promise((a,d)=>{this._queue.push({func:b,resolve:a,reject:d});this._MaybeStartNext()})}_FindInQueue(b){for(let a=0,d=this._queue.length;a<d;++a)if(this._queue[a].func===b)return a;return-1}RemoveAndResolve(b,a){b=this._FindInQueue(b);if(-1===b)throw Error("cannot find promise to resolve");this._queue[b].resolve(a);this._queue.splice(b,
1)}RemoveAndReject(b,a){b=this._FindInQueue(b);if(-1===b)throw Error("cannot find promise to reject");this._queue[b].reject(a);this._queue.splice(b,1)}async _MaybeStartNext(){if(this._queue.length&&!(this._activeCount>=this._maxParallel)){this._activeCount++;var b=this._queue.shift();try{const a=await b.func();b.resolve(a)}catch(a){b.reject(a)}this._activeCount--;this._MaybeStartNext()}}static async Batch(b,a){const d=[];let c=!1;const f=async g=>{for(;(g=a.pop())&&!c;)try{d.push(await g())}catch(l){throw c=
!0,l;}},h=[];for(;b--;)h.push(f());await Promise.all(h);return d}}}
{"use strict";const e=self.C3;e.RateLimiter=class{constructor(b,a,d){this._callback=b;this._interval=a;this._intervalOnBattery=d||2*a;this._timerId=-1;this._lastCallTime=-Infinity;this._timerCallFunc=()=>this._OnTimer();this._canRunImmediate=this._ignoreReset=!1;this._callbackArguments=null}SetCanRunImmediate(b){this._canRunImmediate=!!b}_GetInterval(){return"undefined"!==typeof e.Battery&&e.Battery.IsOnBatteryPower()?this._intervalOnBattery:this._interval}Call(...b){if(-1===this._timerId){this._callbackArguments=
b;b=e.FastGetDateNow();var a=b-this._lastCallTime,d=this._GetInterval();a>=d&&this._canRunImmediate?(this._lastCallTime=b,this._RunCallback()):this._timerId=self.setTimeout(this._timerCallFunc,Math.max(d-a,4))}}_RunCallback(){this._ignoreReset=!0;const b=this._callbackArguments;this._callbackArguments=null;b?this._callback(...b):this._callback();this._ignoreReset=!1}Reset(){this._ignoreReset||(this._CancelTimer(),this._callbackArguments=null,this._lastCallTime=e.FastGetDateNow())}_OnTimer(){this._timerId=
-1;this._lastCallTime=e.FastGetDateNow();this._RunCallback()}_CancelTimer(){-1!==this._timerId&&(self.clearTimeout(this._timerId),this._timerId=-1)}Release(){this._CancelTimer();this._timerCallFunc=this._callbackArguments=this._callback=null}}}
{"use strict";const e=self.C3;e.SVGRasterManager=class{constructor(){this._images=new Map;this._allowNpotSurfaces=!1;this._redrawCallback=this._releaseResultCallback=this._rasterAtSizeCallback=this._getBaseSizeCallback=null}SetNpotSurfaceAllowed(b){this._allowNpotSurfaces=!!b}IsNpotSurfaceAllowed(){return this._allowNpotSurfaces}SetGetBaseSizeCallback(b){this._getBaseSizeCallback=b}GetBaseSize(b){if(!this._getBaseSizeCallback)throw Error("no get base size callback set");return this._getBaseSizeCallback(b)}SetRasterAtSizeCallback(b){this._rasterAtSizeCallback=
b}RasterAtSize(b,a,d,c,f,h){if(!this._rasterAtSizeCallback)throw Error("no raster at size callback set");return this._rasterAtSizeCallback(b,a,d,c,f,h)}SetReleaseResultCallback(b){this._releaseResultCallback=b}ReleaseResult(b){if(!this._releaseResultCallback)throw Error("no release result callback set");this._releaseResultCallback(b)}SetRedrawCallback(b){this._redrawCallback=b}Redraw(){if(!this._redrawCallback)throw Error("no redraw callback set");this._redrawCallback()}AddImage(b){let a=this._images.get(b);
a||(a=e.New(e.SVGRasterImage,this,b),this._images.set(b,a));a.IncReference();return a}_RemoveImage(b){this._images.delete(b.GetDataSource())}OnTexturesChanged(){for(const b of this._images.values())b.ReleaseRasterizedResult(),b.ForceRasterAgain()}}}
{"use strict";const e=self.C3;e.SVGRasterImage=class{constructor(b,a){this._manager=b;this._dataSource=a;this._baseHeight=this._baseWidth=this._refCount=0;this._getBaseSizePromise=this._manager.GetBaseSize(a).then(d=>{this._baseWidth=d[0];this._baseHeight=d[1];this._manager.Redraw()}).catch(d=>{console.error("[SVG] Error loading SVG: ",d);this._hadError=!0;this._manager.Redraw()});this._rasterImageHeight=this._rasterImageWidth=this._rasterSurfaceHeight=this._rasterSurfaceWidth=0;this._isRasterizing=
!1;this._rasterizedResult=null;this._hadError=this._forceRaster=!1}Release(){if(0>=this._refCount)throw Error("already released");this._refCount--;0===this._refCount&&this._Release()}ReleaseRasterizedResult(){this._rasterizedResult&&(this._manager.ReleaseResult(this._rasterizedResult),this._rasterizedResult=null)}_Release(){this.ReleaseRasterizedResult();this._manager._RemoveImage(this);this._manager=null}GetDataSource(){return this._dataSource}IncReference(){this._refCount++}HasReferences(){return 0<
this._refCount}GetRasterizedResult(){return this._rasterizedResult}ForceRasterAgain(){this._forceRaster=!0}async StartRasterForSize(b,a,d){if(0!==a&&0!==d&&!this._hadError&&!this._isRasterizing){var c=e.nextHighestPowerOfTwo(Math.ceil(a)),f=e.nextHighestPowerOfTwo(Math.ceil(d)),h=Math.max(c,f);4096<h&&(h=4096/h,a*=h,d*=h,c=Math.min(Math.ceil(c*h),4096),f=Math.min(Math.ceil(f*h),4096));a<c&&d<f&&(d=a/d,c/f>d?(a=f*d,d=f):(a=c,d=c/d));this._manager.IsNpotSurfaceAllowed()&&(c=Math.ceil(a),f=Math.ceil(d));
c<=this._rasterSurfaceWidth&&f<=this._rasterSurfaceHeight&&!this._forceRaster||(this._isRasterizing=!0,this._rasterSurfaceWidth=c,this._rasterSurfaceHeight=f,b=await this._manager.RasterAtSize(this._dataSource,b,this._rasterSurfaceWidth,this._rasterSurfaceHeight,a,d),this._manager&&(this.ReleaseRasterizedResult(),this._rasterizedResult=b,this._rasterImageWidth=a,this._rasterImageHeight=d,this._forceRaster=this._isRasterizing=!1,this._manager.Redraw()))}}WhenBaseSizeReady(){return this._getBaseSizePromise}GetBaseWidth(){return this._baseWidth}GetBaseHeight(){return this._baseHeight}GetRasterWidth(){return this._rasterImageWidth}GetRasterHeight(){return this._rasterImageHeight}HadError(){return this._hadError}}}
{"use strict";const e=self.C3;e.UTF8_BOM="\ufeff";const b=new Set([..."0123456789"]);e.IsNumericChar=function(m){return b.has(m)};const a=new Set([..." \t\n\r\u00a0\u0085\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u202f\u205f\u3000"]);e.IsWhitespaceChar=function(m){return a.has(m)};e.FilterWhitespace=function(m){return[...m].filter(u=>!e.IsWhitespaceChar(u)).join("")};e.IsStringAllWhitespace=function(m){for(const u of m)if(!e.IsWhitespaceChar(u))return!1;return!0};
e.IsUnprintableChar=function(m){return 1===m.length&&32>m.charCodeAt(0)};e.FilterUnprintableChars=function(m){return[...m].filter(u=>!e.IsUnprintableChar(u)).join("")};const d=new Set([..."0123456789.+-e"]);e.IsStringNumber=function(m){m=m.trim();if(!m.length)return!1;let u=m.charAt(0);if("-"!==u&&!b.has(u))return!1;for(let w of m)if(!d.has(w))return!1;return!0};e.RemoveTrailingDigits=function(m){let u=m.length;for(;0<u;){let w=m.charAt(u-1);if(!e.IsNumericChar(w))break;--u}return m.substr(0,u)};
e.IncrementNumberAtEndOf=function(m){let u=e.RemoveTrailingDigits(m);m=(m=m.substr(u.length))?(parseInt(m,10)+1).toString():"2";return u+m};const c=new Map([["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],["'","&#39;"]]);function f(m){return c.get(m)}const h=/[&<>"']/g;e.EscapeHTML=function(m){return m.replace(h,f)};e.EscapeJS=function(m){m=e.ReplaceAll(m,"\\","\\\\");m=e.ReplaceAll(m,'"','\\"');m=e.ReplaceAll(m,"\t","\\t");m=e.ReplaceAll(m,"\r","");return e.ReplaceAll(m,"\n","\\n")};e.EscapeXML=
function(m){m=e.ReplaceAll(m,"&","&amp;");m=e.ReplaceAll(m,"<","&lt;");m=e.ReplaceAll(m,">","&gt;");return e.ReplaceAll(m,'"',"&quot;")};const g=/[-[\]{}()*+?.,\\^$|#\s]/g;e.EscapeRegex=function(m){return m.replace(g,"\\$&")};e.FindAll=function(m,u,w=!1){if(!u)return[];w||(m=m.toLowerCase(),u=u.toLowerCase());w=u.length;var q=0;let t=[];for(;-1<(q=m.indexOf(u,q));)t.push(q),q+=w;return t};e.ReplaceAll=function(m,u,w){return m.replaceAll(u,()=>w)};e.ReplaceAllCaseInsensitive=function(m,u,w){return m.replace(new RegExp(e.EscapeRegex(u),
"gi"),()=>w)};e.SetElementContent=function(m,u){"string"===typeof u?m.textContent=u:u.isPlainText()?m.textContent=u.toString():(m.innerHTML=u.toHTML(),u instanceof e.BBString&&u.attachLinkHandlers(m))};e.StringLikeEquals=function(m,u){return m instanceof e.HtmlString||m instanceof e.BBString?m.equals(u):u instanceof e.HtmlString||u instanceof e.BBString?u.equals(m):m===u};e.StringSubstitute=function(m,...u){let w=m;for(let q=0,t=u.length;q<t;++q){const p=`{${q}}`;if(!m.includes(p))throw Error(`missing placeholder '${p}' in string substitution`);
w=w.replace(p,u[q].toString())}return w};e.StringSubstituteAllowMissing=function(m,...u){let w=m,q=-1,t=-1;for(let p=0,r=u.length;p<r;++p){const x=`{${p}}`;m.includes(x)?(t=p,w=w.replace(x,u[p].toString())):-1===q&&(q=p)}if(0<=q&&0<=t&&q<t)throw Error(`missing placeholder '${q}' in string substitution`);return w};e.StringSubstituteMap=function(m,u){for(let [w,q]of Object.entries(u))m=m.replaceAll(w,q.toString());return m};e.SortAZ=function(m,u){return m>u?1:m<u?-1:0};e.SortAZCaseInsensitive=function(m,
u){m=m.toLowerCase();u=u.toLowerCase();return m>u?1:m<u?-1:0};e.FormatDataSize=function(m,u){u="common."+(u?"dataRates":"dataSizes")+".";const w=self.langSub;if(1024>m)return w(u+"bytes",m);if(1048576>m)return m/=1024,m=10>m?Math.round(10*m)/10:Math.round(m),w(u+"kilobytes",m);if(1073741824>m)return m/=1048576,m=10>m?Math.round(10*m)/10:Math.round(m),w(u+"megabytes",m);if(1099511627776>m)return m/=1073741824,m=10>m?Math.round(10*m)/10:Math.round(m),w(u+"gigabytes",m);m/=1099511627776;m=10>m?Math.round(10*
m)/10:Math.round(m);return w(u+"terabytes",m)};const l={approximate:!1,days:!0,hours:!0,minutes:!0,seconds:!0};e.FormatTime=function(m,u){u=Object.assign({},l,u);e.Lang.PushContext("common.time");const w=[],q=self.lang,t=self.langPluralSub;if(u.days){var p=Math.floor(m/86400);0<p&&(m-=86400*p,w.push(t(".days",null,p)))}u.hours&&(p=Math.floor(m/3600),0<p||w.length)&&(m-=3600*p,w.push(t(".hours",null,p)));u.minutes&&(p=Math.floor(m/60),0<p||w.length||!u.seconds)&&(m-=60*p,w.push(t(".minutes",null,p)));
u.seconds&&w.push(t(".seconds",null,Math.floor(m%60)));m=(u.approximate?q(".approx-prefix"):"")+w.join(q(".separator"));e.Lang.PopContext();return m};e.ZeroPad=function(m,u){let w=0>m?"-":"";m=Math.abs(m);m=m.toString();u-=m.length;for(let q=0;q<u;++q)w+="0";return w+m};e.StringToTitleCase=function(m){return m.toLowerCase().replace(/\b\w/g,u=>u.toUpperCase())};e.CompareVersionStrings=function(m,u){m=m.split(".").map(w=>w.trim());u=u.split(".").map(w=>w.trim());e.resizeArray(m,4,"0");e.resizeArray(u,
4,"0");m=m.map(w=>parseInt(w,10));u=u.map(w=>parseInt(w,10));for(let w=0;4>w;++w){const q=m[w]-u[w];if(0!==q)return 0>q?-1:1}return 0};e.CreateGUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,m=>{const u=Math.floor(16*Math.random());return("x"===m?u:u&3|8).toString(16)})};e.StringHammingDistance=function(m,u){if(m.length!==u.length)throw Error("strings must be same length");let w=0;for(let q=0,t=m.length;q<t;++q)m.charAt(q)!==u.charAt(q)&&++w;return w};e.StringLevenshteinDistance=
function(m,u){if(0===m.length)return u.length;if(0===u.length)return m.length;let w,q,t,p;if(m.length>u.length){var r=m;m=u;u=r}p=Array(m.length+1);for(r=0;r<=m.length;r++)p[r]=r;for(r=1;r<=u.length;r++){q=r;for(w=1;w<=m.length;w++)t=u[r-1]===m[w-1]?p[w-1]:Math.min(p[w-1]+1,Math.min(q+1,p[w]+1)),p[w-1]=q,q=t;p[m.length]=q}return p[m.length]}}
{"use strict";const e=self.C3,b=new Map([["b","strong"],["i","em"],["s","s"],["u","u"],["sub","sub"],["sup","sup"],["small","small"],["mark","mark"],["a1","a"],["a2","a"],["a3","a"],["a4","a"],["a5","a"],["a6","a"],["a7","a"],["a8","a"],["a9","a"],["bad",["span","bbCodeBad"]],["good",["span","bbCodeGood"]],["info",["span","bbCodeInfo"]],["h1",["span","bbCodeH1"]],["h2",["span","bbCodeH2"]],["h3",["span","bbCodeH3"]],["h4",["span","bbCodeH4"]],["item",["span","bbCodeItem"]]]),a=/\[(\/?)([a-zA-Z0-9]+)\]/g,
d=/\[(\/?)([^\[\n]*?)\]/g;let c=null,f=0;function h(l,m,u){var w=b.get(u);if(w){if("string"===typeof w){if("a"!==w||m)return"<"+m+w+">";m=parseInt(u.substring(1),10)-1;if(0>m||m>=c.length)throw Error("invalid bbcode link substitution");w=c[m];if("string"===typeof w)return`<a href="${c[m]}">`;if("function"===typeof w)return`<a class="bblink${m}">`;throw new TypeError("invalid bbcode link action");}if(Array.isArray(w))return l=w[0],w=w[1],m?"</"+l+">":`<${l} class="${w}">`}else return"class"===u?m?
"</span>":`<span class="bbclass${f++}">`:l}const g=/\n/g;e.BBString=class{constructor(l,m){this._bbstr=m&&m.noEscape?l:e.EscapeHTML(l);this._htmlstr="";this._convertLineBreaks=!1;this._linkActions=[];if(m&&(this._convertLineBreaks=!!m.convertLineBreaks,m.links)){if(9<m.links.length)throw Error("too many links");this._linkActions=m.links}this._hasAnyBBtags=this._bbstr.includes("[");this._needsLineBreakConversion=this._convertLineBreaks&&this._bbstr.includes("\n");this._isPlain=!this._hasAnyBBtags&&
!this._needsLineBreakConversion&&!this._bbstr.includes("&");this._hasParsedFragments=!1;this._fragments=[]}toString(){return this._bbstr}valueOf(){return this._bbstr}isPlainText(){return this._isPlain}toPlainText(){return this._hasAnyBBtags?this._bbstr.replace(a,""):this._bbstr}toHTML(){if(this._isPlain)return this._bbstr;if(!this._htmlstr&&this._bbstr){let l=this._bbstr;this._hasAnyBBtags&&(f=0,c=this._linkActions,l=l.replace(a,h),c=null);this._needsLineBreakConversion&&(l=l.replace(g,"<br>"));this._htmlstr=
l}return this._htmlstr}attachLinkHandlers(l){if(this._linkActions.length)for(let m=0,u=this._linkActions.length;m<u;++m){const w=this._linkActions[m];if("function"!==typeof w)continue;const q=l.querySelector(".bblink"+m);if(!q)throw Error("unable to attach BBString link handler");q.onclick=w}}equals(l){return l instanceof e.HtmlString?this.toHTML()===l.toHTML():l instanceof e.BBString?this._bbstr===l._bbstr:this._bbstr===l}toFragmentList(){if(this._hasParsedFragments)return this._fragments;const l=
this._bbstr,m=[];let u=d.lastIndex=0;for(var w;null!==(w=d.exec(l));){var q=w.index;if(0<q&&"\\"===l.charAt(q-1))continue;var t=w[0],p=w[1];w=w[2];const r=l.substring(u,q);u=q+t.length;r&&this._fragments.push({text:r,styles:m.slice(0)});if(w)if(p)for(w=w.toLowerCase(),q=m.length-1;0<=q;--q){if(m[q].tag===w){m.splice(q,1);break}}else q=w,t=null,p=w.indexOf("="),-1!==p?(q=w.substring(0,p).toLowerCase(),t=w.substring(p+1)):q=q.toLowerCase(),m.push({tag:q,param:t})}u<l.length&&this._fragments.push({text:l.substring(u),
styles:m.slice(0)});for(const r of this._fragments)r.text=this._ProcessBBCodeEscapeSequences(r.text);this._hasParsedFragments=!0;return this._fragments}_ProcessBBCodeEscapeSequences(l){l=e.ReplaceAll(l,"\\[","[");return e.ReplaceAll(l,"\\\\","\\")}static StripTags(l){return e.New(e.BBString,l,{noEscape:!0}).toPlainText()}static StripAnyTags(l){return l.replace(d,"")}}}
{"use strict";const e=self.C3;function b(c){return"\u00a0"===c||"\u202f"===c?!1:e.IsWhitespaceChar(c)}const a=/[\x09\x0A\x0B\x0C\x0D\x20\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u205F\u3000\u2028\u2029\uFEFF]*$/;function d(c){return c.replace(a,"")}e.WordWrap=class{constructor(){this._lines=[]}GetLines(){return this._lines}GetLineCount(){return this._lines.length}_MeasureLine(c,f){let h=0,g=0,l=0,m=0,u=0;for(const w of c)-1===w.width&&(c=f(w.text,w.styles),w.width=
c.width,w.height=c.height,w.fontBoundingBoxAscent=c.fontBoundingBoxAscent||0,w.fontBoundingBoxDescent=c.fontBoundingBoxDescent||0,w.topToAlphabeticDistance=c.topToAlphabeticDistance||0),h+=w.width,g=Math.max(g,w.height),l=Math.max(l,w.fontBoundingBoxAscent),m=Math.max(m,w.fontBoundingBoxDescent),u=Math.max(u,w.topToAlphabeticDistance);return{width:h,height:g,fontBoundingBoxAscent:l,fontBoundingBoxDescent:m,topToAlphabeticDistance:u}}_AddLine(c,f,h,g,l,m){this._lines.push({fragments:c,width:f,height:h,
fontBoundingBoxAscent:g,fontBoundingBoxDescent:l,topToAlphabeticDistance:m})}WordWrap(c,f,h,g,l){"string"===typeof c&&(c=[{text:c,styles:[]}]);e.clearArray(this._lines);if(!(!c.length||1===c.length&&!c[0].text.length||2>h)){if(1===c.length){var m=c[0];const u=m.text;m=m.styles;if(100>=u.length&&!u.includes("\n")){let {width:w,height:q,fontBoundingBoxAscent:t,fontBoundingBoxDescent:p,topToAlphabeticDistance:r}=f(u,m);w+=l;t=t||0;p=p||0;r=r||0;if(w<=h){this._AddLine([{text:u,styles:m,width:w,height:q,
fontBoundingBoxAscent:t,fontBoundingBoxDescent:p,topToAlphabeticDistance:r}],w,q,t,p,r);return}}}if("word"===g)g=this._TokeniseWords(c);else{g=[];for(const u of c)e.appendArray(g,[...u.text].map(w=>[{text:w,styles:u.styles}]))}this._WrapText(g,f,h,l)}}_TokeniseWords(c){const f=[];let h=[],g=!1;for(const m of c){var l=m.text;c=m.styles;for(const u of l)"\n"===u?(0<h.length&&f.push(h),f.push([{text:"\n",styles:c}]),h=[]):0===h.length?(h.push({text:u,styles:c}),g=b(u)):(l=b(u),l===g?(l=h.at(-1),l.styles===
c?l.text+=u:h.push({text:u,styles:c})):(f.push(h),h=[],h.push({text:u,styles:c}),g=l))}0<h.length&&f.push(h);return f}_CopyLine(c){return c.map(f=>({text:f.text,styles:f.styles,width:f.width,height:f.height,fontBoundingBoxAscent:f.fontBoundingBoxAscent,fontBoundingBoxDescent:f.fontBoundingBoxDescent,topToAlphabeticDistance:f.topToAlphabeticDistance}))}_AddWordToLine(c,f){var h=c.length?c.at(-1):null;let g=0;h&&f[0].styles===h.styles&&(h.text+=f[0].text,h.width=-1,h.height=-1,h.fontBoundingBoxAscent=
-1,h.fontBoundingBoxDescent=-1,h.topToAlphabeticDistance=-1,g=1);for(h=f.length;g<h;++g){const l=f[g];c.push({text:l.text,styles:l.styles,width:-1,height:-1,fontBoundingBoxAscent:-1,fontBoundingBoxDescent:-1,topToAlphabeticDistance:-1})}}_WrapText(c,f,h,g){let l=[],m=0,u=0,w=0,q=0;var t=0;for(const p of c){if(1===p.length&&"\n"===p[0].text){0===u&&(t=f(" ",p[0].styles),u=t.height,w=t.fontBoundingBoxAscent||0,q=t.fontBoundingBoxDescent||0,t=t.topToAlphabeticDistance||0);this._AddLine(l,m,u,w,q,t);
l=[];t=q=w=u=m=0;continue}c=this._CopyLine(l);this._AddWordToLine(c,p);const r=this._MeasureLine(c,f),x=r.width;x>=h?(0<l.length&&this._AddLine(l,m,u,w,q,t),l=[],e.IsStringAllWhitespace(p[0].text)?t=q=w=u=m=0:(this._AddWordToLine(l,p),t=this._MeasureLine(l,f),m=t.width,u=t.height,w=t.fontBoundingBoxAscent,q=t.fontBoundingBoxDescent,t=t.topToAlphabeticDistance)):(l=c,m=x,u=r.height,w=r.fontBoundingBoxAscent,q=r.fontBoundingBoxDescent,t=r.topToAlphabeticDistance)}0<l.length&&this._AddLine(l,m,u,w,q,
t);this._TrimLinesTrailingWhitespace(f,g)}_TrimLinesTrailingWhitespace(c,f){for(const g of this._lines){const l=g.fragments;if(!l.length)continue;let m=l.at(-1);var h=m.text;const u=d(h);if(!u)g.width-=m.width,l.pop();else if(u.length<h.length){h=c(u,m.styles).width;const w=m.width-h;m.width=h;m.text=u;g.width-=w}0!==f&&0<l.length&&(m=l.at(-1),m.width+=f,g.width+=f)}}Clear(){e.clearArray(this._lines)}GetMaxLineWidth(){return this._lines.reduce((c,f)=>Math.max(c,f.width),0)}GetTotalLineHeight(){return this._lines.reduce((c,
f)=>c+f.height,0)}}}
{"use strict";const e=self.C3,b=self.glMatrix,a=b.vec3,d=b.vec4,c=b.mat4,f=a.create(),h=a.create(),g=a.create(),l=d.create(),m=c.create(),u=a.create(),w=a.create(),q=a.create(),t=a.create(),p=a.create(),r=a.create(),x=a.create(),y=a.create(),D=d.fromValues(0,0,1,1);e.Gfx={Project(B,I,L,Q,S,U,V){const Z=Q[0]*B+Q[4]*I+Q[8]*L+Q[12],ma=Q[1]*B+Q[5]*I+Q[9]*L+Q[13],va=Q[2]*B+Q[6]*I+Q[10]*L+Q[14];Q=Q[3]*B+Q[7]*I+Q[11]*L+Q[15];B=S[0]*Z+S[4]*ma+S[8]*va+S[12]*Q;I=S[1]*Z+S[5]*ma+S[9]*va+S[13]*Q;L=S[2]*Z+S[6]*
ma+S[10]*va+S[14]*Q;S=S[3]*Z+S[7]*ma+S[11]*va+S[15]*Q;if(0===S)return!1;S=1/S;V[0]=(B*S*.5+.5)*U[2]+U[0];V[1]=(I*S*.5+.5)*U[3]+U[1];V[2]=.5*(1+L*S);return!0},Unproject(B,I,L,Q,S,U,V){c.multiply(m,S,Q);if(null===c.invert(m,m))return!1;l[0]=(B-U[0])/U[2]*2-1;l[1]=(I-U[1])/U[3]*2-1;l[2]=2*L-1;l[3]=1;d.transformMat4(l,l,m);if(0===l[3])return!1;l[3]=1/l[3];V[0]=l[0]*l[3];V[1]=l[1]*l[3];V[2]=l[2]*l[3];return!0},UnprojectScreenToWorldZ(B,I,L,Q,S,U,V){if(!e.Gfx.Unproject(B,I,0,Q,S,U,f)||!e.Gfx.Unproject(B,
I,1,Q,S,U,h))return!1;a.subtract(h,h,f);a.set(g,0,0,1);B=-L;I=a.dot(g,h);L=0;if(0===I){if(0!==a.dot(g,f)+B)return!1}else if(L=-(a.dot(f,g)+B)/I,0>L)return!1;a.scaleAndAdd(V,f,h,L);return!0}};function G(B,I,L,Q){a.subtract(f,L,I);a.subtract(h,B,I);a.cross(g,f,h);a.normalize(g,g);Q.set(g[0],g[1],g[2],a.dot(B,g))}function A(B,I,L,Q,S,U,V){const Z=V.x,ma=V.y,va=V.z,Na=V.w,Ea=V.xF,Ia=V.yF;V=V.zF;const Ma=1-Ea,Fa=1-Ia,ya=1-V;return Z*B*Ea+Z*Q*Ma+ma*I*Ia+ma*S*Fa+va*L*V+va*U*ya>=Na?!0:Z*Q*Ea+Z*B*Ma+ma*S*
Ia+ma*I*Fa+va*U*V+va*L*ya>Na}function F(B,I,L,Q){return Q.x*B+Q.y*I+Q.z*L>=Q.w}class J{constructor(){this.zF=this.yF=this.xF=this.w=this.z=this.y=this.x=NaN}set(B,I,L,Q){this.x=B;this.y=I;this.z=L;this.w=Q;this.xF=0<B?1:0;this.yF=0<I?1:0;this.zF=0<L?1:0}}e.Gfx.ViewFrustum=class{constructor(){this._leftP=new J;this._topP=new J;this._rightP=new J;this._bottomP=new J;this._nearP=new J;this._farP=new J}CalculatePlanes(B,I){e.Gfx.Unproject(0,1,0,B,I,D,u);e.Gfx.Unproject(1,1,0,B,I,D,w);e.Gfx.Unproject(0,
0,0,B,I,D,q);e.Gfx.Unproject(1,0,0,B,I,D,t);e.Gfx.Unproject(0,1,1,B,I,D,p);e.Gfx.Unproject(1,1,1,B,I,D,r);e.Gfx.Unproject(0,0,1,B,I,D,x);e.Gfx.Unproject(1,0,1,B,I,D,y);G(q,u,p,this._leftP);G(u,w,r,this._topP);G(w,t,y,this._rightP);G(t,q,x,this._bottomP);G(x,p,r,this._farP);G(t,w,u,this._nearP)}ContainsAABB(B,I,L,Q,S,U){return A(B,I,L,Q,S,U,this._leftP)&&A(B,I,L,Q,S,U,this._topP)&&A(B,I,L,Q,S,U,this._rightP)&&A(B,I,L,Q,S,U,this._bottomP)&&A(B,I,L,Q,S,U,this._nearP)&&A(B,I,L,Q,S,U,this._farP)}IsBehindNearPlane(B,
I,L){return!F(B,I,L,this._nearP)}}}
{"use strict";const e=self.C3,b=self.glMatrix,a=b.vec3,d=b.vec4,c=b.mat4,f=c.create(),h=a.fromValues(0,0,0),g=a.fromValues(0,0,0),l=a.fromValues(0,0,0),m=a.fromValues(0,1,0);d.fromValues(0,0,0,0);const u=new e.Quad,w=new e.Rect,q=new e.Quad(0,0,1,0,1,1,0,1);e.Gfx.RendererBase=class{constructor(){this._height=this._width=0;this._fovY=e.toRadians(45);this._tan_fovY_2=Math.tan(this._fovY/2);this._matP=c.create();this._matMV=c.create();this._zAxisScale=!1;this._allShaderPrograms=[];this._shaderProgramsByName=
new Map;this._spSmoothLineFill=this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spTilemapFill=this._spPoints=this._spTextureFill=null;this._stateGroups=new Map;this._currentStateGroup=null;this._blendModeTable=[];this._namedBlendModeMap=new Map;this._currentZ=this._baseZ=0;this._lineWidth=1;this._lineWidthStack=[this._lineWidth];this._lineCap=1;this._lineCapStack=[this._lineCap];this._lineOffset=
.5;this._lineOffsetStack=[this._lineOffset];this._frameNumber=0;this._enableMipmaps=!0;this._hasMajorPerformanceCaveat=!1}FillIndexBufferData(t){let p=0,r=t.length,x=0;for(;p<r;)t[p++]=x,t[p++]=x+1,t[p++]=x+2,t[p++]=x,t[p++]=x+2,t[p++]=x+3,x+=4}_ClearState(){this._currentZ=this._baseZ=0;this._spSmoothLineFill=this._spSmoothEllipseOutline=this._spSmoothEllipseFill=this._spHardEllipseOutline=this._spHardEllipseFill=this._spLinearGradientFill=this._spColorFill=this._spTilemapFill=this._spPoints=this._spTextureFill=
null;this._ClearAllShaderPrograms()}InitState(){this._ClearState();this._currentStateGroup=null}OnDeviceOrContextLost(){for(const t of this._allShaderPrograms)t.Release();this._ClearState()}GetWidth(){return this._width}GetHeight(){return this._height}GetDefaultCameraZ(t){return this.IsZAxisScaleNormalized()?100:t/(2*this._GetTanFovYDiv2())}GetZAxisScaleFactor(t){return this.IsZAxisScaleNormalized()?t/(2*this._GetTanFovYDiv2())/this.GetDefaultCameraZ(t):1}GetNearZ(){return 1}GetFarZ(){return 1E4}SetFovY(t){this._fovY=
t;this._tan_fovY_2=Math.tan(this._fovY/2)}GetFovY(){return this._fovY}_GetTanFovYDiv2(){return this._tan_fovY_2}SetZAxisScaleNormalized(){this._zAxisScale=!1}SetZAxisScaleRegular(){this._zAxisScale=!0}IsZAxisScaleNormalized(){return!this._zAxisScale}IsZAxisScaleRegular(){return this._zAxisScale}CalculatePerspectiveMatrix(t,p,r=.5,x=.5){const y=this.GetNearZ(),D=this.GetFarZ();var G=this.GetFovY();if(.5===r&&.5===x)this.IsWebGPU()?c.perspectiveZO(t,G,p,y,D):c.perspective(t,G,p,y,D);else{r=1-r;G=2*
r-2;r*=2;const A=2*x-2;x*=2;const F=this._GetTanFovYDiv2()*y;p*=F;c.frustum(t,G*p,r*p,A*F,x*F,y,D)}}CalculateOrthographicMatrix(t,p,r,x=1){var y=self.devicePixelRatio;const D=2*this.GetDefaultCameraZ(r)*y*this._GetTanFovYDiv2()/r;p=p*D/(2*y*x);r=r*D/(2*y*x);x=-p;y=-r;this.IsWebGPU()?c.orthoZO(t,x,p,y,r,this.GetNearZ(),this.GetFarZ()):c.ortho(t,x,p,y,r,this.GetNearZ(),this.GetFarZ())}CalculateLookAtModelView(t,p,r,x,y,D=1){let G=1;this.IsZAxisScaleNormalized()&&(G=200*this._GetTanFovYDiv2()/y);a.set(l,
G,-G,1);a.multiply(h,p,l);a.multiply(g,r,l);c.lookAt(t,h,g,x||m);l[2]=D;c.scale(t,t,l)}CalculateLookAtModelView2(t,p,r,x,y,D,G,A){a.set(h,t,p,r);a.set(g,x,y,D);this.CalculateLookAtModelView(f,h,g,m,G,A);return f}_AddShaderProgram(t){this._allShaderPrograms.push(t);this._shaderProgramsByName.set(t.GetName(),t)}_RemoveShaderProgram(t){const p=this._allShaderPrograms.indexOf(t);-1!==p&&this._allShaderPrograms.splice(p,1);this._shaderProgramsByName.delete(t.GetName())}_ClearAllShaderPrograms(){e.clearArray(this._allShaderPrograms);
this._shaderProgramsByName.clear()}GetShaderProgramByName(t){return this._shaderProgramsByName.get(t)||null}GetTextureFillShaderProgram(){return this._spTextureFill}SetTextureFillMode(){this.SetProgram(this._spTextureFill)}GetPointsRenderingProgram(){return this._spPoints}SetPointsRenderingProgram(){this.SetProgram(this._spPoints)}SetTilemapFillMode(){this.SetProgram(this._spTilemapFill)}SetColorFillMode(){this.SetProgram(this._spColorFill)}SetLinearGradientFillMode(){this.SetProgram(this._spLinearGradientFill)}SetHardEllipseFillMode(){this.SetProgram(this._spHardEllipseFill)}SetHardEllipseOutlineMode(){this.SetProgram(this._spHardEllipseOutline)}SetSmoothEllipseFillMode(){this.SetProgram(this._spSmoothEllipseFill)}SetSmoothEllipseOutlineMode(){this.SetProgram(this._spSmoothEllipseOutline)}SetSmoothLineFillMode(){this.SetProgram(this._spSmoothLineFill)}_SetCurrentStateGroup(t){this._currentStateGroup=
t}GetCurrentStateGroup(){return this._currentStateGroup}AcquireStateGroup(t,p,r,x){const y=e.Gfx.StateGroup.MakeKey(t,p,r,x);let D=this._stateGroups.get(y);D||(D=e.New(e.Gfx.StateGroup,this,t,p,r,x),this._stateGroups.set(y,D));D.AddRef();return D}ReleaseStateGroup(t){t.DecRef();0===t._GetRefCount()&&(this._currentStateGroup===t&&(this._currentStateGroup=null),this._stateGroups.delete(t.GetKey()),t.Release())}_InitBlendModeData(t){e.clearArray(this._blendModeTable);this._namedBlendModeMap.clear();
let p=0;for(const r of t){t=r[0];const x=r[1],y=r[2];this._blendModeTable.push([x,y]);this._namedBlendModeMap.set(t,{number:p,srcBlend:x,destBlend:y});p++}}_GetBlendByIndex(t){return this._blendModeTable[t]}GetSrcBlendByIndex(t){return this._GetBlendByIndex(t)[0]}GetDestBlendByIndex(t){return this._GetBlendByIndex(t)[1]}GetNamedBlend(t){t=this._namedBlendModeMap.get(t);if("undefined"===typeof t)throw Error("invalid blend name");return t}NamedBlendToNumber(t){t=this._namedBlendModeMap.get(t);if("undefined"===
typeof t)throw Error("invalid blend name");return t.number}SetBaseZ(t){this._baseZ=t}GetBaseZ(){return this._baseZ}SetCurrentZ(t){this._currentZ=t;this._currentStateGroup=null}GetCurrentZ(){return this._currentZ}Line(t,p,r,x){var y=e.angleTo(t,p,r,x),D=.5*this._lineWidth;const G=Math.sin(y)*D;y=Math.cos(y)*D;D=this._lineCap;2===D?this.LinePreCalc_LineCap2(t,p,0,r,x,0,G,y):1===D?this.LinePreCalc_LineCap1(t,p,0,r,x,0,G,y):this.LinePreCalc_LineCap0(t,p,0,r,x,0,G,y)}Line3D(t,p,r,x,y,D){var G=e.angleTo(t,
p,x,y),A=.5*this._lineWidth;const F=Math.sin(G)*A;G=Math.cos(G)*A;A=this._lineCap;2===A?this.LinePreCalc_LineCap2(t,p,r,x,y,D,F,G):1===A?this.LinePreCalc_LineCap1(t,p,r,x,y,D,F,G):this.LinePreCalc_LineCap0(t,p,r,x,y,D,F,G)}LinePreCalc_LineCap2(t,p,r,x,y,D,G,A){var F=this._lineOffset;t=t+F-A;p=p+F-G;x=x+F+A;y=y+F+G;F=2*A;const J=2*G;this.Quad3D2(t+G,p-A,r,x+G,y-A,D,x-G-F,y+A-J,D,t-G+F,p+A+J,r,q)}LinePreCalc_LineCap1(t,p,r,x,y,D,G,A){const F=this._lineOffset;t=t+F-A;p=p+F-G;x=x+F+A;y=y+F+G;this.Quad3D2(t+
G,p-A,r,x+G,y-A,D,x-G,y+A,D,t-G,p+A,r,q)}LinePreCalc_LineCap0(t,p,r,x,y,D,G,A){const F=this._lineOffset;t+=F;p+=F;x+=F;y+=F;this.Quad3D2(t+G,p-A,r,x+G,y-A,D,x-G,y+A,D,t-G,p+A,r,q)}TexturedLine(t,p,r,x,y,D){var G=e.angleTo(t,p,r,x),A=.5*this._lineWidth;const F=Math.sin(G)*A;G=Math.cos(G)*A;A=this._lineCap;2===A?this.TexturedLinePreCalc_LineCap2(t,p,r,x,F,G,y,D):1===A?this.TexturedLinePreCalc_LineCap1(t,p,r,x,F,G,y,D):this.TexturedLinePreCalc_LineCap0(t,p,r,x,F,G,y,D)}TexturedLinePreCalc_LineCap2(t,
p,r,x,y,D,G,A){var F=this._lineOffset;t=t+F-D;p=p+F-y;r=r+F+D;x=x+F+y;F=2*D;const J=2*y;u.set(t+y,p-D,r+y,x-D,r-y-F,x+D-J,t-y+F,p+D+J);w.set(G,0,A,0);this.Quad3(u,w)}TexturedLinePreCalc_LineCap1(t,p,r,x,y,D,G,A){const F=this._lineOffset;t=t+F-D;p=p+F-y;r=r+F+D;x=x+F+y;u.set(t+y,p-D,r+y,x-D,r-y,x+D,t-y,p+D);w.set(G,0,A,0);this.Quad3(u,w)}TexturedLinePreCalc_LineCap0(t,p,r,x,y,D,G,A){const F=this._lineOffset;t+=F;p+=F;r+=F;x+=F;u.set(t+y,p-D,r+y,x-D,r-y,x+D,t-y,p+D);w.set(G,0,A,0);this.Quad3(u,w)}LineRect(t,
p,r,x){const y=.5*this._lineWidth,D=this._lineCap;2===D?this._LineRectPreCalc_LineCap2(t,p,r,x,y):1===D?this._LineRectPreCalc_LineCap1(t,p,r,x,y):this._LineRectPreCalc_LineCap0(t,p,r,x,y)}_LineRectPreCalc_LineCap2(t,p,r,x,y){this.LinePreCalc_LineCap2(t,p,0,r,p,0,0,y);this.LinePreCalc_LineCap2(r,p,0,r,x,0,y,0);this.LinePreCalc_LineCap2(r,x,0,t,x,0,0,-y);this.LinePreCalc_LineCap2(t,x,0,t,p,0,-y,0)}_LineRectPreCalc_LineCap1(t,p,r,x,y){this.LinePreCalc_LineCap1(t,p,0,r,p,0,0,y);this.LinePreCalc_LineCap1(r,
p,0,r,x,0,y,0);this.LinePreCalc_LineCap1(r,x,0,t,x,0,0,-y);this.LinePreCalc_LineCap1(t,x,0,t,p,0,-y,0)}_LineRectPreCalc_LineCap0(t,p,r,x,y){this.LinePreCalc_LineCap0(t,p,0,r,p,0,0,y);this.LinePreCalc_LineCap0(r,p,0,r,x,0,y,0);this.LinePreCalc_LineCap0(r,x,0,t,x,0,0,-y);this.LinePreCalc_LineCap0(t,x,0,t,p,0,-y,0)}LineRect2(t){this.LineRect(t.getLeft(),t.getTop(),t.getRight(),t.getBottom())}LineQuad(t){var p=e.angleTo(t.getTlx(),t.getTly(),t.getTrx(),t.getTry()),r=.5*this._lineWidth;const x=Math.sin(p)*
r;p=Math.cos(p)*r;r=this._lineCap;2===r?this._LineQuadPreCalc_LineCap2(t,x,p):1===r?this._LineQuadPreCalc_LineCap1(t,x,p):this._LineQuadPreCalc_LineCap0(t,x,p)}_LineQuadPreCalc_LineCap2(t,p,r){this.LinePreCalc_LineCap2(t.getTlx(),t.getTly(),0,t.getTrx(),t.getTry(),0,p,r);this.LinePreCalc_LineCap2(t.getTrx(),t.getTry(),0,t.getBrx(),t.getBry(),0,r,-p);this.LinePreCalc_LineCap2(t.getBrx(),t.getBry(),0,t.getBlx(),t.getBly(),0,-p,-r);this.LinePreCalc_LineCap2(t.getBlx(),t.getBly(),0,t.getTlx(),t.getTly(),
0,-r,p)}_LineQuadPreCalc_LineCap1(t,p,r){this.LinePreCalc_LineCap1(t.getTlx(),t.getTly(),0,t.getTrx(),t.getTry(),0,p,r);this.LinePreCalc_LineCap1(t.getTrx(),t.getTry(),0,t.getBrx(),t.getBry(),0,r,-p);this.LinePreCalc_LineCap1(t.getBrx(),t.getBry(),0,t.getBlx(),t.getBly(),0,-p,-r);this.LinePreCalc_LineCap1(t.getBlx(),t.getBly(),0,t.getTlx(),t.getTly(),0,-r,p)}_LineQuadPreCalc_LineCap0(t,p,r){this.LinePreCalc_LineCap0(t.getTlx(),t.getTly(),0,t.getTrx(),t.getTry(),0,p,r);this.LinePreCalc_LineCap0(t.getTrx(),
t.getTry(),0,t.getBrx(),t.getBry(),0,r,-p);this.LinePreCalc_LineCap0(t.getBrx(),t.getBry(),0,t.getBlx(),t.getBly(),0,-p,-r);this.LinePreCalc_LineCap0(t.getBlx(),t.getBly(),0,t.getTlx(),t.getTly(),0,-r,p)}SetLineWidth(t){this._lineWidth=t;this._lineWidthStack[this._lineWidthStack.length-1]=t}GetLineWidth(){return this._lineWidth}PushLineWidth(t){if(100<=this._lineWidthStack.length)throw Error("pushed too many line widths - check push/pop pairs");this._lineWidthStack.push(t);this._lineWidth=t}PopLineWidth(){if(1>=
this._lineWidthStack.length)throw Error("cannot pop last line width - check push/pop pairs");this._lineWidthStack.pop();this._lineWidth=this._lineWidthStack.at(-1)}SetLineCapButt(){this._lineCap=0;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapSquare(){this._lineCap=1;this._lineCapStack[this._lineCapStack.length-1]=0}SetLineCapZag(){this._lineCap=2;this._lineCapStack[this._lineCapStack.length-1]=0}PushLineCap(t){if("butt"===t)this.PushLineCapButt();else if("square"===t)this.PushLineCapSquare();
else if("zag"===t)this.PushLineCapZag();else throw Error("invalid line cap");}PushLineCapButt(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(0);this._lineCap=0}PushLineCapSquare(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");this._lineCapStack.push(1);this._lineCap=1}PushLineCapZag(){if(100<=this._lineCapStack.length)throw Error("pushed too many line caps - check push/pop pairs");
this._lineCapStack.push(2);this._lineCap=2}PopLineCap(){if(1>=this._lineCapStack.length)throw Error("cannot pop last line cap - check push/pop pairs");this._lineCapStack.pop();this._lineCap=this._lineCapStack.at(-1)}SetLineOffset(t){this._lineOffset=t;this._lineOffsetStack[this._lineOffsetStack.length-1]=t}GetLineOffset(){return this._lineOffset}PushLineOffset(t){if(100<=this._lineOffsetStack.length)throw Error("pushed too many line offsets - check push/pop pairs");this._lineOffsetStack.push(t);this._lineOffset=
t}PopLineOffset(){if(1>=this._lineOffsetStack.length)throw Error("cannot pop last line offset - check push/pop pairs");this._lineOffsetStack.pop();this._lineOffset=this._lineOffsetStack.at(-1)}ConvexPoly(t){var p=t.length/2;if(3>p)throw Error("need at least 3 points");p-=2;const r=p-1,x=t[0],y=t[1];for(let D=0;D<p;D+=2){const G=2*D,A=t[G+2],F=t[G+3],J=t[G+4],B=t[G+5];D===r?this.Quad2(x,y,A,F,J,B,J,B):this.Quad2(x,y,A,F,J,B,t[G+6],t[G+7])}}GetNumVertexComponents(){return 3}Finish(){this.EndBatch(!0);
this._frameNumber++}GetFrameNumber(){return this._frameNumber}IncrementFrameNumber(){this._frameNumber++}SetMipmapsEnabled(t){this._enableMipmaps=!!t}AreMipmapsEnabled(){return this._enableMipmaps}SetHasMajorPerformanceCaveat(t){this._hasMajorPerformanceCaveat=!!t}HasMajorPerformanceCaveat(){return this._hasMajorPerformanceCaveat}IsWebGL(){return!1}IsWebGPU(){return!1}}}"use strict";
self.C3.Gfx.ShaderProgramBase=class{constructor(e,b,a){this._name=b;this._renderer=e;this._extendBoxHorizontal=a.extendBoxHorizontal||0;this._extendBoxVertical=a.extendBoxVertical||0;this._crossSampling=!!a.crossSampling;this._mustPreDraw=!!a.mustPreDraw;this._preservesOpaqueness=!!a.preservesOpaqueness;this._animated=!!a.animated;this._blendsBackground=!!a.blendsBackground;this._usesDepth=!!a.usesDepth;this._usesAnySrcRectOrPixelSize=!1;this._needsPostDrawOrExtendBox=this._crossSampling||this._blendsBackground||
0!==this._extendBoxHorizontal||0!==this._extendBoxVertical}Release(){this._renderer=null}GetRenderer(){return this._renderer}GetName(){return this._name}ExtendsBox(){return 0!==this._extendBoxHorizontal||0!==this._extendBoxVertical}GetBoxExtendHorizontal(){return this._extendBoxHorizontal}GetBoxExtendVertical(){return this._extendBoxVertical}UsesCrossSampling(){return this._crossSampling}MustPreDraw(){return this._mustPreDraw}PreservesOpaqueness(){return this._preservesOpaqueness}IsAnimated(){return this._animated}BlendsBackground(){return this._blendsBackground}UsesDepth(){return this._usesDepth}UsesAnySrcRectOrPixelSize(){return this._usesAnySrcRectOrPixelSize}NeedsPostDrawOrExtendsBox(){return this._needsPostDrawOrExtendBox}};
{"use strict";const e=self.C3;e.Gfx.StateGroup=class{constructor(b,a,d,c,f){this._renderer=b;this._refCount=0;this._shaderProgram=null;this._shaderProgramName="";this._blendMode=d;this._color=e.New(e.Color);this._color.set(c);this._zElevation=f;"string"===typeof a?this._shaderProgramName=a:(this._shaderProgram=a,this._shaderProgramName=this._shaderProgram.GetName())}Release(){if(0<this._refCount)throw Error("releasing state group still in use");this._shaderProgram=this._renderer=null;this._shaderProgramName=
""}Apply(){const b=this._renderer;b.SetProgram(this._shaderProgram);b.SetBlendMode(this._blendMode);b.SetColor(this._color);b.SetCurrentZ(this._zElevation);b._SetCurrentStateGroup(this)}GetKey(){return e.Gfx.StateGroup.MakeKey(this._shaderProgramName,this._blendMode,this._color,this._zElevation)}AddRef(){++this._refCount}DecRef(){--this._refCount}_GetRefCount(){return this._refCount}OnContextLost(){this._shaderProgram=null}OnContextRestored(b){this._shaderProgram=b.GetShaderProgramByName(this._shaderProgramName);
if(!this._shaderProgram)throw Error("failed to restore shader program");}static MakeKey(b,a,d,c){return("string"===typeof b?b:b.GetName())+","+a+","+d.getR()+","+d.getG()+","+d.getB()+","+d.getA()+","+c}}}
{"use strict";const e=self.C3,b=e.New(e.Quad);function a(d,c,f){const h=f.getTlx(),g=f.getTly(),l=f.getTrx()-h,m=f.getTry()-g,u=f.getBlx()-h;f=f.getBly()-g;return[h+l*d+u*c,g+m*d+f*c]}e.Gfx.MeshPoint=class{constructor(d,c,f){this._mesh=d;this._col=c;this._row=f;this._v=this._u=this._zElevation=this._y=this._x=0}_Init(d,c,f,h){this._x=d;this._y=c;this._u=f;this._v=h}GetX(){return this._x}SetX(d){this._x!==d&&(this._x=d,this._mesh._SetPointsChanged())}GetY(){return this._y}SetY(d){this._y!==d&&(this._y=
d,this._mesh._SetPointsChanged())}GetZElevation(){return this._zElevation}SetZElevation(d){this._zElevation!==d&&(this._zElevation=Math.max(d,0),this._mesh._SetPointsChanged())}GetU(){return this._u}SetU(d){this._u=d}GetV(){return this._v}SetV(d){this._v=d}_Interpolate_TexRect(d,c,f){[this._x,this._y]=a(d._x,d._y,c);this._zElevation=d._zElevation;this._u=e.lerp(f.getLeft(),f.getRight(),d._u);this._v=e.lerp(f.getTop(),f.getBottom(),d._v)}_Interpolate_TexQuad(d,c,f){[this._x,this._y]=a(d._x,d._y,c);
this._zElevation=d._zElevation;[this._u,this._v]=a(d._u,d._v,f)}SaveToJson(){return{x:this.GetX(),y:this.GetY(),z:this.GetZElevation(),u:this.GetU(),v:this.GetV()}}LoadFromJson(d){this.SetX(d.x);this.SetY(d.y);d.hasOwnProperty("z")&&this.SetZElevation(d.z);this.SetU(d.u);this.SetV(d.v)}GetMesh(){return this._mesh}GetColumn(){return this._col}GetRow(){return this._row}};e.Gfx.Mesh=class{constructor(d,c,f){if(2>d||2>c)throw Error("invalid mesh size");this._hsize=d;this._vsize=c;this._owner=f||null;
this._pts=[];this._minY=this._minX=0;this._maxY=this._maxX=1;this._maxZ=0;this._pointsChanged=!1;f=d-1;const h=c-1;for(let g=0;g<c;++g){const l=[];for(let m=0;m<d;++m){const u=e.New(e.Gfx.MeshPoint,this,m,g),w=m/f,q=g/h;u._Init(w,q,w,q);l.push(u)}this._pts.push(l)}}Release(){e.clearArray(this._pts)}GetHSize(){return this._hsize}GetVSize(){return this._vsize}GetOwner(){return this._owner}_GetPoints(){return this._pts}_SetPointsChanged(){this._pointsChanged=!0}_MaybeComputeBounds(){if(this._pointsChanged){var d=
Infinity,c=Infinity,f=-Infinity,h=-Infinity,g=0;for(const l of this._pts)for(const m of l){const u=m.GetX(),w=m.GetY();d=Math.min(d,u);c=Math.min(c,w);f=Math.max(f,u);h=Math.max(h,w);g=Math.max(g,m.GetZElevation())}this._minX=d;this._minY=c;this._maxX=f;this._maxY=h;this._maxZ=g;this._pointsChanged=!1}}GetMinX(){this._MaybeComputeBounds();return this._minX}GetMinY(){this._MaybeComputeBounds();return this._minY}GetMaxX(){this._MaybeComputeBounds();return this._maxX}GetMaxY(){this._MaybeComputeBounds();
return this._maxY}GetMaxZ(){this._MaybeComputeBounds();return this._maxZ}HasAnyZElevation(){return 0<this.GetMaxZ()}GetMeshPointAt(d,c){d=Math.floor(d);c=Math.floor(c);return 0>d||d>=this._hsize||0>c||c>=this._vsize?null:this._pts[c][d]}CalculateTransformedMesh(d,c,f){const h=f instanceof e.Rect;if(d.GetHSize()!==this.GetHSize()||d.GetVSize()!==this.GetVSize())throw Error("source mesh wrong size");d=d._pts;const g=this._pts;for(let l=0,m=g.length;l<m;++l){const u=d[l],w=g[l];for(let q=0,t=w.length;q<
t;++q){const p=u[q],r=w[q];h?r._Interpolate_TexRect(p,c,f):r._Interpolate_TexQuad(p,c,f)}}}Draw(d){const c=this._pts;let f=c[0];for(let h=1,g=c.length;h<g;++h){const l=c[h];let m=f[0],u=l[0];for(let w=1,q=l.length;w<q;++w){const t=f[w],p=l[w];b.set(m.GetU(),m.GetV(),t.GetU(),t.GetV(),p.GetU(),p.GetV(),u.GetU(),u.GetV());d.Quad3D2(m.GetX(),m.GetY(),m.GetZElevation(),t.GetX(),t.GetY(),t.GetZElevation(),p.GetX(),p.GetY(),p.GetZElevation(),u.GetX(),u.GetY(),u.GetZElevation(),b);m=t;u=p}f=l}}Outline(d,
c){c||(c=(g,l,m)=>[g,l,m]);const f=this._pts;let h=f[0];for(let g=1,l=f.length;g<l;++g){const m=f[g];let u=h[0],w=m[0];for(let q=1,t=m.length;q<t;++q){const p=h[q],r=m[q],[x,y,D]=c(u.GetX(),u.GetY(),u.GetZElevation()),[G,A,F]=c(p.GetX(),p.GetY(),p.GetZElevation()),[J,B,I]=c(r.GetX(),r.GetY(),r.GetZElevation()),[L,Q,S]=c(w.GetX(),w.GetY(),w.GetZElevation());d.Line3D(x,y,D,G,A,F);d.Line3D(x,y,D,J,B,I);d.Line3D(x,y,D,L,Q,S);q===t-1&&d.Line3D(G,A,F,J,B,I);g===l-1&&d.Line3D(L,Q,S,J,B,I);u=p;w=r}h=m}}InsertPolyMeshVertices(d){d=
d.pointsArr();const c=[],f=this.GetHSize()-1,h=this.GetVSize()-1,g=1/f,l=1/h,m=f-1,u=h-1;let w=d[0],q=d[1],t=e.clamp(Math.floor(w*f),0,m),p=e.clamp(Math.floor(q*h),0,u),r=0,x=0,y=0;var D=-1;const G=()=>{w=e.clamp(e.lerp(w,r,y),0,1);q=e.clamp(e.lerp(q,x,y),0,1);c.push(w,q)};for(let A=0,F=d.length;A<F;A+=2)for(w=d[A],q=d[A+1],c.push(w,q),t=e.clamp(Math.floor(w*f),0,m),p=e.clamp(Math.floor(q*h),0,u),D=(A+2)%F,r=d[D],x=d[D+1],D=-1;;){if(1E6<c.length)throw Error("Too many mesh poly points");const J=t*
g,B=p*l,I=(t+1)*g,L=(p+1)*l;e.isPointInTriangleInclusive(w,q,J,B,I,B,I,L);if(0!==D&&(y=e.rayIntersectExtended(w,q,r,x,J,B,I,L,-.001),0<=y&&.99999999>=y)){G();D=0;continue}if(0<p&&2!==D&&(y=e.rayIntersectExtended(w,q,r,x,J,B,I,B,.001),0<=y&&.99999999>=y)){G();p--;D=4;continue}if(t<m&&3!==D&&(y=e.rayIntersectExtended(w,q,r,x,I,B,I,L,.001),0<=y&&.99999999>=y)){G();t++;D=1;continue}if(0<t&&1!==D&&(y=e.rayIntersectExtended(w,q,r,x,J,B,J,L,.001),0<=y&&.99999999>=y)){G();t--;D=3;continue}if(p<u&&4!==D&&
(y=e.rayIntersectExtended(w,q,r,x,J,L,I,L,.001),0<=y&&.99999999>=y)){G();p++;D=2;continue}break}return e.New(e.CollisionPoly,c)}TransformCollisionPoly(d,c){d=this._TransformPolyPoints(d);this._SimplifyPoly(d);c.setPoints(d)}_TransformPolyPoints(d){const c=[];d=d.pointsArr();for(let f=0,h=d.length;f<h;f+=2){const [g,l]=this.TransformPoint(d[f],d[f+1]);c.push(g,l)}return c}TransformPoint(d,c){var f=this.GetHSize()-1,h=this.GetVSize()-1,g=1/f,l=1/h;f=e.clamp(Math.floor(d*f),0,f-1);const m=e.clamp(Math.floor(c*
h),0,h-1);h=f*g;const u=m*l,w=(f+1)*g,q=(m+1)*l,t=this.GetMeshPointAt(f,m),p=this.GetMeshPointAt(f+1,m+1),r=e.isPointInTriangleInclusive(d,c,h,u,w,u,w,q);g=r?h+g:h;l=r?u:u+l;f=this.GetMeshPointAt(f+(r?1:0),m+(r?0:1));const [x,y,D]=e.triangleCartesianToBarycentric(d,c,h,u,g,l,w,q);return e.triangleBarycentricToCartesian(x,y,D,t.GetX(),t.GetY(),f.GetX(),f.GetY(),p.GetX(),p.GetY())}_SimplifyPoly(d){const c=[];let f=d[0],h=d[1],g=f-d.at(-2),l=h-d.at(-1);for(let u=0,w=d.length;u<w;u+=2){var m=(u+2)%w;
const q=d[m];m=d[m+1];const t=q-f,p=m-h,r=1E-7>Math.abs(p)&&1E-7>Math.abs(l)&&Math.sign(t)===Math.sign(g);(!(1E-7>Math.abs(t)&&1E-7>Math.abs(g)&&Math.sign(p)===Math.sign(l)||r)&&1E-7<Math.abs(t/g-p/l)||0==t&&0===p)&&c.push(f,h);f=q;h=m;g=t;l=p}6<=c.length&&c.length<d.length&&e.shallowAssignArray(d,c)}SaveToJson(){return{cols:this.GetHSize(),rows:this.GetVSize(),points:this._pts.map(d=>d.map(c=>c.SaveToJson()))}}LoadFromJson(d){const c=this.GetHSize(),f=this.GetVSize();if(d.cols!==c||d.rows!==f)throw Error("mesh data wrong size");
d=d.points;for(let h=0;h<f;++h){const g=d[h];for(let l=0;l<c;++l)this.GetMeshPointAt(l,h).LoadFromJson(g[l])}}}}
{"use strict";const e=self.C3,b=new Set(["rgba8","rgb8","rgba4","rgb5_a1","rgb565"]),a=new Set(["nearest","bilinear","trilinear"]),d=new Set(["default","low","high"]),c=new Set(["clamp-to-edge","repeat","mirror-repeat"]);function f(m,u){let w,q;switch(m){case "rgba8":m=u.RGBA8;q=w=u.RGBA;u=u.UNSIGNED_BYTE;break;case "rgb8":m=u.RGB8;q=w=u.RGB;u=u.UNSIGNED_BYTE;break;case "rgba4":m=u.RGBA4;q=w=u.RGBA;u=u.UNSIGNED_SHORT_4_4_4_4;break;case "rgb5_a1":m=u.RGB5_A1;q=w=u.RGBA;u=u.UNSIGNED_SHORT_5_5_5_1;break;
case "rgb565":m=u.RGB565;q=w=u.RGB;u=u.UNSIGNED_SHORT_5_6_5;break;default:throw Error("invalid pixel format");}return{sizedinternalformat:m,internalformat:w,format:q,type:u}}const h={wrapX:"clamp-to-edge",wrapY:"clamp-to-edge",sampling:"trilinear",anisotropy:0,pixelFormat:"rgba8",mipMap:!0,mipMapQuality:"default",premultiplyAlpha:!0,isSvg:!1,width:-1,height:-1},g={premultiplyAlpha:!0,flipY:!1},l=new Set;e.Gfx.WebGLRendererTexture=class{constructor(m){this._renderer=m;this._texture=null;this._height=
this._width=0;this._isStatic=!0;this._wrapY=this._wrapX="clamp-to-edge";this._sampling="trilinear";this._anisotropy=0;this._pixelFormat="rgba8";this._isMipMapped=!1;this._mipMapQuality="default";this._refCount=0}_CreateStatic(m,u){if(!("undefined"!==typeof HTMLImageElement&&m instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&m instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&m instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&m instanceof OffscreenCanvas||
m instanceof ImageData||m instanceof ArrayBuffer)&&null!==m)throw Error("invalid texture source");u=Object.assign({},h,u);if(this._texture)throw Error("already created texture");this._wrapX=u.wrapX;this._wrapY=u.wrapY;this._sampling=u.sampling;this._anisotropy=u.anisotropy;this._pixelFormat=u.pixelFormat;this._isMipMapped=!!u.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=u.mipMapQuality;if(!c.has(this._wrapX)||!c.has(this._wrapY))throw Error("invalid wrap mode");if(!a.has(this._sampling))throw Error("invalid sampling");
if(!b.has(this._pixelFormat))throw Error("invalid pixel format");if(!d.has(this._mipMapQuality))throw Error("invalid mipmap quality");this._isStatic=!0;if(m instanceof ArrayBuffer||null===m||u.isSvg){if(this._width=u.width,this._height=u.height,m instanceof ArrayBuffer&&m.byteLength!==this._width*this._height*4)throw Error("ArrayBuffer wrong size");}else this._width=m.width,this._height=m.height;if(0>=this._width||0>=this._height)throw Error("invalid texture data size");if(u.isSvg){var w=e.CreateCanvas(this._width,
this._height);w.getContext("2d").drawImage(m,0,0,this._width,this._height);m=w}var q=e.isPOT(this._width)&&e.isPOT(this._height);w=this._renderer.GetMaxTextureSize();if(this._width>w||this._height>w)throw Error("texture data exceeds maximum texture size");w=this._renderer.GetContext();var t=this._renderer.GetWebGLVersionNumber();this._texture=w.createTexture();w.bindTexture(w.TEXTURE_2D,this._texture);w.pixelStorei(w.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);w.pixelStorei(w.UNPACK_FLIP_Y_WEBGL,
!1);u=f(this._pixelFormat,w);if(this._renderer.SupportsNPOTTextures()||q||!this._IsTiled())2<=t?(w.texStorage2D(w.TEXTURE_2D,this._isMipMapped?Math.floor(Math.log2(Math.max(this._width,this._height))+1):1,u.sizedinternalformat,this._width,this._height),m instanceof ArrayBuffer?w.texSubImage2D(w.TEXTURE_2D,0,0,0,this._width,this._height,u.format,u.type,new Uint8Array(m)):null!==m&&w.texSubImage2D(w.TEXTURE_2D,0,0,0,u.format,u.type,m)):m instanceof ArrayBuffer?w.texImage2D(w.TEXTURE_2D,0,u.internalformat,
this._width,this._height,0,u.format,u.type,new Uint8Array(m)):null===m?w.texImage2D(w.TEXTURE_2D,0,u.internalformat,this._width,this._height,0,u.format,u.type,null):w.texImage2D(w.TEXTURE_2D,0,u.internalformat,u.format,u.type,m);else{if(null===m)throw Error("cannot pass null data when creating a NPOT tiled texture without NPOT support");m instanceof ArrayBuffer&&(m=new ImageData(new Uint8ClampedArray(m),this._width,this._height));m instanceof ImageData&&(q=e.CreateCanvas(this._width,this._height),
q.getContext("2d").putImageData(m,0,0),m=q);q=e.CreateCanvas(e.nextHighestPowerOfTwo(this._width),e.nextHighestPowerOfTwo(this._height));t=q.getContext("2d");t.imageSmoothingEnabled="nearest"!==this._sampling;t.drawImage(m,0,0,this._width,this._height,0,0,q.width,q.height);w.texImage2D(w.TEXTURE_2D,0,u.internalformat,u.format,u.type,q)}null!==m&&this._SetTextureParameters(w);w.bindTexture(w.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;l.add(this)}_CreateDynamic(m,u,w){w=Object.assign({},
h,w);if(this._texture)throw Error("already created texture");this._wrapX=w.wrapX;this._wrapY=w.wrapY;this._sampling=w.sampling;this._pixelFormat=w.pixelFormat;this._isMipMapped=!!w.mipMap&&this._renderer.AreMipmapsEnabled();this._mipMapQuality=w.mipMapQuality;if(!c.has(this._wrapX)||!c.has(this._wrapY))throw Error("invalid wrap mode");if(!a.has(this._sampling))throw Error("invalid sampling");if(!b.has(this._pixelFormat))throw Error("invalid pixel format");if(!d.has(this._mipMapQuality))throw Error("invalid mipmap quality");
this._isStatic=!1;this._width=Math.floor(m);this._height=Math.floor(u);m=e.isPOT(this._width)&&e.isPOT(this._height);u=this._renderer.GetMaxTextureSize();if(0>=this._width||0>=this._height)throw Error("invalid texture size");if(this._width>u||this._height>u)throw Error("texture exceeds maximum texture size");if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!m)throw Error("non-power-of-two tiled textures not supported");m=this._renderer.GetContext();u=this._renderer.GetWebGLVersionNumber();
this._texture=m.createTexture();m.bindTexture(m.TEXTURE_2D,this._texture);m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,w.premultiplyAlpha);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,!1);w=f(this._pixelFormat,m);m.texImage2D(m.TEXTURE_2D,0,2<=u?w.sizedinternalformat:w.internalformat,this._width,this._height,0,w.format,w.type,null);this._SetTextureParameters(m);m.bindTexture(m.TEXTURE_2D,null);this._renderer._ResetLastTexture();this._refCount=1;l.add(this)}_GetMipMapHint(m){if("default"===this._mipMapQuality)return this._isStatic?
m.NICEST:m.FASTEST;if("low"===this._mipMapQuality)return m.FASTEST;if("high"===this._mipMapQuality)return m.NICEST;throw Error("invalid mipmap quality");}_IsTiled(){return"clamp-to-edge"!==this._wrapX||"clamp-to-edge"!==this._wrapY}_GetTextureWrapMode(m,u){if("clamp-to-edge"===u)return m.CLAMP_TO_EDGE;if("repeat"===u)return m.REPEAT;if("mirror-repeat"===u)return m.MIRRORED_REPEAT;throw Error("invalid wrap mode");}_SetTextureParameters(m){var u=e.isPOT(this._width)&&e.isPOT(this._height);m.texParameteri(m.TEXTURE_2D,
m.TEXTURE_WRAP_S,this._GetTextureWrapMode(m,this._wrapX));m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,this._GetTextureWrapMode(m,this._wrapY));"nearest"===this._sampling?(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST),this._isMipMapped=!1):(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.LINEAR),(u||this._renderer.SupportsNPOTTextures())&&this._isMipMapped?(m.hint(m.GENERATE_MIPMAP_HINT,this._GetMipMapHint(m)),m.generateMipmap(m.TEXTURE_2D),
u="trilinear"===this._sampling&&!this._renderer.HasMajorPerformanceCaveat(),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,u?m.LINEAR_MIPMAP_LINEAR:m.LINEAR_MIPMAP_NEAREST)):(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.LINEAR),this._isMipMapped=!1));(u=this._renderer._GetAnisotropicExtension())&&0<this._anisotropy&&"nearest"!==this._sampling&&m.texParameterf(m.TEXTURE_2D,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(this._anisotropy,this._renderer._GetMaxAnisotropy()))}_Update(m,u){if(!("undefined"!==
typeof HTMLImageElement&&m instanceof HTMLImageElement||"undefined"!==typeof HTMLVideoElement&&m instanceof HTMLVideoElement||"undefined"!==typeof HTMLCanvasElement&&m instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&m instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&m instanceof OffscreenCanvas||m instanceof ImageData))throw Error("invalid texture source");if(!this._texture||0>=this._refCount)throw Error("texture not created");if(this._isStatic)throw Error("cannot update static texture");
u=Object.assign({},g,u);const w=m.width||m.videoWidth,q=m.height||m.videoHeight;var t=this._renderer.GetWebGLVersionNumber();const p=this._renderer.GetContext();p.bindTexture(p.TEXTURE_2D,this._texture);p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha);p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,!!u.flipY);u=f(this._pixelFormat,p);t=2<=t?u.sizedinternalformat:u.internalformat;try{if(this._width===w&&this._height===q){const r=e.isPOT(this._width)&&e.isPOT(this._height);p.texSubImage2D(p.TEXTURE_2D,
0,0,0,u.format,u.type,m);(r||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(p.hint(p.GENERATE_MIPMAP_HINT,this._GetMipMapHint(p)),p.generateMipmap(p.TEXTURE_2D))}else{this._width=w;this._height=q;const r=e.isPOT(this._width)&&e.isPOT(this._height);if(!this._renderer.SupportsNPOTTextures()&&this._IsTiled()&&!r)throw Error("non-power-of-two tiled textures not supported");p.texImage2D(p.TEXTURE_2D,0,t,u.format,u.type,m);(r||this._renderer.SupportsNPOTTextures())&&this._isMipMapped&&(p.hint(p.GENERATE_MIPMAP_HINT,
this._GetMipMapHint(p)),p.generateMipmap(p.TEXTURE_2D))}}catch(r){console.error("Error updating WebGL texture: ",r)}p.bindTexture(p.TEXTURE_2D,null);this._renderer._ResetLastTexture()}_Delete(){if(0<this._refCount)throw Error("texture still has references");if(!this._texture)throw Error("already deleted texture");l.delete(this);this._renderer.GetContext().deleteTexture(this._texture);this._texture=null}IsValid(){return!!this._texture}_GetTexture(){return this._texture}GetRenderer(){return this._renderer}AddReference(){this._refCount++}SubtractReference(){if(0>=
this._refCount)throw Error("no more references");this._refCount--}GetReferenceCount(){return this._refCount}GetWidth(){return this._width}GetHeight(){return this._height}IsStatic(){return this._isStatic}GetEstimatedMemoryUsage(){let m=this._width*this._height;switch(this._pixelFormat){case "rgba8":m*=4;break;case "rgb8":m*=3;break;case "rgba4":case "rgb5_a1":case "rgb565":m*=2}this._isMipMapped&&(m+=Math.floor(m/3));return m}static OnContextLost(){l.clear()}static allTextures(){return l.values()}}}
{"use strict";const e=self.C3,b=self.glMatrix.mat4,a=new Set(["nearest","bilinear","trilinear"]),d={sampling:"trilinear",alpha:!0,depth:!1,isSampled:!0,isDefaultSize:!0,multisampling:0},c=new Set;e.Gfx.WebGLRenderTarget=class{constructor(f){this._renderer=f;this._renderBuffer=this._texture=this._frameBufferNoDepth=this._frameBuffer=null;this._height=this._width=0;this._isDefaultSize=!0;this._sampling="trilinear";this._alpha=!0;this._depth=!1;this._isSampled=!0;this._multisampling=0;this._projectionMatrix=
b.create();this._lastFov=0}_Create(f,h,g){g=Object.assign({},d,g);const l=this._renderer.GetWebGLVersionNumber();if(this._texture||this._renderBuffer)throw Error("already created render target");this._sampling=g.sampling;this._alpha=!!g.alpha;this._depth=!!g.depth;this._isSampled=!!g.isSampled;this._isDefaultSize=!!g.isDefaultSize;this._multisampling=g.multisampling;if(!a.has(this._sampling))throw Error("invalid sampling");if(0<this._multisampling&&(2>l||this._isSampled))throw Error("invalid use of multisampling");
2>l&&(this._isSampled=!0);this._width=f;this._height=h;if(0>=this._width||0>=this._height)throw Error("invalid render target size");this._CalculateProjection();f=this._renderer.GetContext();this._frameBuffer=f.createFramebuffer();this._depth&&(this._frameBufferNoDepth=f.createFramebuffer());this._isSampled?(this._texture=this._renderer.CreateDynamicTexture(this._width,this._height,{sampling:this._sampling,pixelFormat:this._alpha?"rgba8":"rgb8",mipMap:!1}),h=this._texture._GetTexture(),f.bindFramebuffer(f.FRAMEBUFFER,
this._frameBuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,h,0),this._depth&&(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBufferNoDepth),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,h,0))):(this._renderBuffer=f.createRenderbuffer(),f.bindRenderbuffer(f.RENDERBUFFER,this._renderBuffer),h=this._alpha?f.RGBA8:f.RGB8,0<this._multisampling&&((g=f.getInternalformatParameter(f.RENDERBUFFER,h,f.SAMPLES))&&g[0]?(g=g[0],this._multisampling>g&&(this._multisampling=
g)):this._multisampling=0),0===this._multisampling?f.renderbufferStorage(f.RENDERBUFFER,h,this._width,this._height):f.renderbufferStorageMultisample(f.RENDERBUFFER,this._multisampling,h,this._width,this._height),f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.RENDERBUFFER,this._renderBuffer),this._depth&&(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBufferNoDepth),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.RENDERBUFFER,
this._renderBuffer)),f.bindRenderbuffer(f.RENDERBUFFER,null));h=this._renderer._GetDepthBuffer();this._depth&&h&&(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer),this._renderer._CanSampleDepth()?f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.TEXTURE_2D,h,0):f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,h));f.bindFramebuffer(f.FRAMEBUFFER,null);c.add(this)}_Resize(f,h){if(this._width!==f||this._height!==h)this._width=f,this._height=h,this._CalculateProjection(),
f=this._renderer.GetContext(),f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer),this._texture?this._texture._Update(new ImageData(this._width,this._height)):(f.bindRenderbuffer(f.RENDERBUFFER,this._renderBuffer),f.renderbufferStorage(f.RENDERBUFFER,this._alpha?f.RGBA8:f.RGB8,this._width,this._height),f.bindRenderbuffer(f.RENDERBUFFER,null)),h=this._renderer._GetDepthBuffer(),this._depth&&h&&(this._renderer._CanSampleDepth()?f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.TEXTURE_2D,
h,0):f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,h)),f.bindFramebuffer(f.FRAMEBUFFER,null)}_Delete(){if(!this._texture&&!this._renderBuffer)throw Error("already deleted render target");c.delete(this);var f=this._renderer.GetContext();this._texture?(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,null,0),this._depth&&(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBufferNoDepth),f.framebufferTexture2D(f.FRAMEBUFFER,
f.COLOR_ATTACHMENT0,f.TEXTURE_2D,null,0)),this._renderer.DeleteTexture(this._texture),this._texture=null):this._renderBuffer&&(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBuffer),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.RENDERBUFFER,null),this._depth&&(f.bindFramebuffer(f.FRAMEBUFFER,this._frameBufferNoDepth),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.RENDERBUFFER,null)),f.deleteRenderbuffer(this._renderBuffer),this._renderBuffer=null);f.bindFramebuffer(f.FRAMEBUFFER,
null);2<=this._renderer.GetWebGLVersionNumber()&&(f.bindFramebuffer(f.READ_FRAMEBUFFER,null),f.bindFramebuffer(f.DRAW_FRAMEBUFFER,null));f.deleteFramebuffer(this._frameBuffer);this._depth&&f.deleteFramebuffer(this._frameBufferNoDepth);f=this._renderer.GetBatchState();f.currentFramebuffer=null;this._frameBuffer=f.currentFramebufferNoDepth=null}_CalculateProjection(){this._renderer.CalculatePerspectiveMatrix(this._projectionMatrix,this._width/this._height);this._lastFov=this._renderer.GetFovY()}_GetFramebuffer(){return this._frameBuffer}_GetFramebufferNoDepth(){return this._frameBufferNoDepth}GetRenderer(){return this._renderer}GetTexture(){return this._texture}GetProjectionMatrix(){this._renderer.GetFovY()!==
this._lastFov&&this._CalculateProjection();return this._projectionMatrix}IsLinearSampling(){return"nearest"!==this._sampling}HasAlpha(){return this._alpha}IsSampled(){return this._isSampled}HasDepthBuffer(){return this._depth}GetWidth(){return this._width}GetHeight(){return this._height}IsDefaultSize(){return this._isDefaultSize}GetMultisampling(){return this._multisampling}GetOptions(){const f={sampling:this._sampling,alpha:this._alpha,isSampled:this._isSampled};this._isDefaultSize||(f.width=this._width,
f.height=this._height);return f}IsCompatibleWithOptions(f){f=Object.assign({},d,f);return"nearest"!==f.sampling!==this.IsLinearSampling()||!!f.alpha!==this.HasAlpha()||!!f.depth!==this.HasDepthBuffer()||2<=this._renderer.GetWebGLVersionNumber()&&!!f.isSampled!==this.IsSampled()?!1:"number"===typeof f.width||"number"===typeof f.height?!this.IsDefaultSize()&&this.GetWidth()===f.width&&this.GetHeight()===f.height:this.IsDefaultSize()}_GetWebGLTexture(){return this._texture?this._texture._GetTexture():
null}GetEstimatedMemoryUsage(){return this._texture?this._texture.GetEstimatedMemoryUsage():this._width*this._height*(this._alpha?4:3)}static async DebugReadPixelsToBlob(f,h){f=await f.ReadBackRenderTargetToImageData(h,!0);return await e.ImageDataToBlob(f)}static OnContextLost(){c.clear()}static allRenderTargets(){return c.values()}static ResizeAll(f,h){for(const g of c)g.IsDefaultSize()&&g._Resize(f,h)}}}
{"use strict";const e=self.C3,b=new Set("aPos aTex aPoints matP matMV samplerFront samplerBack samplerDepth destStart destEnd srcStart srcEnd srcOriginStart srcOriginEnd pixelSize seconds devicePixelRatio layerScale layerAngle layoutStart layoutEnd color color2_ pointTexStart pointTexEnd zElevation tileSize tileSpacing outlineThickness".split(" "));e.Gfx.WebGLShaderProgram=class extends e.Gfx.ShaderProgramBase{static async Compile(a,d,c,f){const h=a.GetContext(),g=h.createShader(h.FRAGMENT_SHADER);
h.shaderSource(g,d);h.compileShader(g);d=h.createShader(h.VERTEX_SHADER);h.shaderSource(d,c);h.compileShader(d);const l=h.createProgram();h.attachShader(l,g);h.attachShader(l,d);h.bindAttribLocation(l,0,"aPos");h.bindAttribLocation(l,1,"aTex");h.bindAttribLocation(l,2,"aPoints");h.linkProgram(l);const m=a._GetParallelShaderCompileExtension();m?await a._WaitForObjectReady(()=>h.getProgramParameter(l,m.COMPLETION_STATUS_KHR)):await e.Wait(5);if(!h.getShaderParameter(g,h.COMPILE_STATUS))throw f=h.getShaderInfoLog(g),
h.deleteShader(g),h.deleteShader(d),h.deleteProgram(l),Error("Error compiling fragment shader: "+f);if(!h.getShaderParameter(d,h.COMPILE_STATUS))throw f=h.getShaderInfoLog(d),h.deleteShader(g),h.deleteShader(d),h.deleteProgram(l),Error("Error compiling vertex shader: "+f);if(!h.getProgramParameter(l,h.LINK_STATUS))throw f=h.getProgramInfoLog(l),h.deleteShader(g),h.deleteShader(d),h.deleteProgram(l),Error("Error linking shader program: "+f);(a=e.FilterUnprintableChars(h.getProgramInfoLog(l)||"").trim())&&
!e.IsStringAllWhitespace(a)&&console.info(`[WebGL] Shader program '${f}' compilation log: `,a);h.deleteShader(g);h.deleteShader(d);return l}static async Create(a,d,c,f){c=await e.Gfx.WebGLShaderProgram.Compile(a,d.src,c,f);return new e.Gfx.WebGLShaderProgram(a,c,d,f)}constructor(a,d,c,f){super(a,f,c);const h=a.GetContext();var g=a.GetBatchState();a.EndBatch();h.useProgram(d);this._gl=h;this._shaderProgram=d;this._isDeviceTransform="<default-device-transform>"===f;f=h.getAttribLocation(d,"aPos");const l=
h.getAttribLocation(d,"aTex");this._locAPoints=h.getAttribLocation(d,"aPoints");-1!==f&&(h.bindBuffer(h.ARRAY_BUFFER,a._vertexBuffer),h.vertexAttribPointer(f,a.GetNumVertexComponents(),h.FLOAT,!1,0,0),h.enableVertexAttribArray(f));-1!==l&&(h.bindBuffer(h.ARRAY_BUFFER,a._texcoordBuffer),h.vertexAttribPointer(l,2,h.FLOAT,!1,0,0),h.enableVertexAttribArray(l));-1!==this._locAPoints&&(h.bindBuffer(h.ARRAY_BUFFER,a._pointBuffer),h.vertexAttribPointer(this._locAPoints,4,h.FLOAT,!1,0,0),h.enableVertexAttribArray(this._locAPoints));
h.bindBuffer(h.ARRAY_BUFFER,null);this._uMatP=new e.Gfx.WebGLShaderUniform(this,"matP","mat4");this._uMatMV=new e.Gfx.WebGLShaderUniform(this,"matMV","mat4");this._uColor=new e.Gfx.WebGLShaderUniform(this,"color","vec4");this._uSamplerFront=new e.Gfx.WebGLShaderUniform(this,"samplerFront","sampler");this._uPointTexStart=new e.Gfx.WebGLShaderUniform(this,"pointTexStart","vec2");this._uPointTexEnd=new e.Gfx.WebGLShaderUniform(this,"pointTexEnd","vec2");this._uZElevation=new e.Gfx.WebGLShaderUniform(this,
"zElevation","float");this._uTileSize=new e.Gfx.WebGLShaderUniform(this,"tileSize","vec2");this._uTileSpacing=new e.Gfx.WebGLShaderUniform(this,"tileSpacing","vec2");this._uColor2=new e.Gfx.WebGLShaderUniform(this,"color2_","vec4");this._uOutlineThickness=new e.Gfx.WebGLShaderUniform(this,"outlineThickness","float");this._uSamplerBack=new e.Gfx.WebGLShaderUniform(this,"samplerBack","sampler");this._uSamplerDepth=new e.Gfx.WebGLShaderUniform(this,"samplerDepth","sampler");this._uDestStart=new e.Gfx.WebGLShaderUniform(this,
"destStart","vec2");this._uDestEnd=new e.Gfx.WebGLShaderUniform(this,"destEnd","vec2");this._uSrcStart=new e.Gfx.WebGLShaderUniform(this,"srcStart","vec2");this._uSrcEnd=new e.Gfx.WebGLShaderUniform(this,"srcEnd","vec2");this._uSrcOriginStart=new e.Gfx.WebGLShaderUniform(this,"srcOriginStart","vec2");this._uSrcOriginEnd=new e.Gfx.WebGLShaderUniform(this,"srcOriginEnd","vec2");this._uPixelSize=new e.Gfx.WebGLShaderUniform(this,"pixelSize","vec2");this._uSeconds=new e.Gfx.WebGLShaderUniform(this,"seconds",
"float");this._uDevicePixelRatio=new e.Gfx.WebGLShaderUniform(this,"devicePixelRatio","float");this._uLayerScale=new e.Gfx.WebGLShaderUniform(this,"layerScale","float");this._uLayerAngle=new e.Gfx.WebGLShaderUniform(this,"layerAngle","float");this._uLayoutStart=new e.Gfx.WebGLShaderUniform(this,"layoutStart","vec2");this._uLayoutEnd=new e.Gfx.WebGLShaderUniform(this,"layoutEnd","vec2");this._hasAnyOptionalUniforms=!!(this._uPixelSize.IsUsed()||this._uSeconds.IsUsed()||this._uSamplerBack.IsUsed()||
this._uDestStart.IsUsed()||this._uDestEnd.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed()||this._uDevicePixelRatio.IsUsed()||this._uLayerScale.IsUsed()||this._uLayerAngle.IsUsed()||this._uLayoutStart.IsUsed()||this._uLayoutEnd.IsUsed());a=c.parameters||[];this._uCustomParameters=[];this._usesAnySrcRectOrPixelSize=this._uPixelSize.IsUsed()||this._uSrcStart.IsUsed()||this._uSrcEnd.IsUsed()||this._uSrcOriginStart.IsUsed()||this._uSrcOriginEnd.IsUsed();
this._hasCurrentMatMV=this._hasCurrentMatP=!1;this._uColor.Init4f(1,1,1,1);this._uColor2.Init4f(1,1,1,1);this._uSamplerFront.Init1i(0);this._uSamplerBack.Init1i(1);this._uSamplerDepth.Init1i(2);this._uPointTexStart.Init2f(0,0);this._uPointTexEnd.Init2f(1,1);this._uZElevation.Init1f(0);this._uTileSize.Init2f(0,0);this._uTileSpacing.Init2f(0,0);this._uDestStart.Init2f(0,0);this._uDestEnd.Init2f(1,1);this._uSrcStart.Init2f(0,0);this._uSrcEnd.Init2f(0,0);this._uSrcOriginStart.Init2f(0,0);this._uSrcOriginEnd.Init2f(0,
0);this._uPixelSize.Init2f(0,0);this._uDevicePixelRatio.Init1f(1);this._uLayerScale.Init1f(1);this._uLayerAngle.Init1f(0);this._uSeconds.Init1f(0);this._uLayoutStart.Init2f(0,0);this._uLayoutEnd.Init2f(0,0);this._uOutlineThickness.Init1f(1);for(const m of a)a=m[2],d=new e.Gfx.WebGLShaderUniform(this,m[0],a),"color"===a?d.Init3f(0,0,0):d.Init1f(0),this._uCustomParameters.push(d);this._isDeviceTransform?this._UpdateDeviceTransformUniforms(g.currentMatP):(this.UpdateMatP(g.currentMatP,!0),this.UpdateMatMV(g.currentMV,
!0));g=g.currentShader;h.useProgram(g?g._shaderProgram:null)}Release(){this._gl.deleteProgram(this._shaderProgram);this._shaderProgram=null;this._renderer._RemoveShaderProgram(this);this._gl=null;super.Release()}GetWebGLContext(){return this._gl}GetShaderProgram(){return this._shaderProgram}GetParameterCount(){return this._uCustomParameters.length}GetParameterType(a){return this._uCustomParameters[a].GetType()}AreCustomParametersAlreadySetInBatch(a){for(let d=0,c=a.length;d<c;++d)if(!this._uCustomParameters[d].IsSetToCustomInBatch(a[d]))return!1;
return!0}SetCustomParametersInBatch(a){for(let d=0,c=a.length;d<c;++d)this._uCustomParameters[d].SetBatchValueCustom(a[d])}AreOptionalUniformsAlreadySetInBatch(a,d,c,f,h,g,l,m,u,w){return this._uSamplerBack.IsUsed()||this._uPixelSize.IsUsed()&&!this._uPixelSize.IsSetTo2InBatch(h,g)||this._uDestStart.IsUsed()&&!this._uDestStart.IsSetTo2InBatch(a.getLeft(),a.getTop())||this._uDestEnd.IsUsed()&&!this._uDestEnd.IsSetTo2InBatch(a.getRight(),a.getBottom())||this._uDevicePixelRatio.IsUsed()&&!this._uDevicePixelRatio.IsSetTo1InBatch(l)||
this._uLayerScale.IsUsed()&&!this._uLayerScale.IsSetTo1InBatch(m)||this._uLayerAngle.IsUsed()&&!this._uLayerAngle.IsSetTo1InBatch(u)||this._uSrcStart.IsUsed()&&!this._uSrcStart.IsSetTo2InBatch(d.getLeft(),d.getTop())||this._uSrcEnd.IsUsed()&&!this._uSrcEnd.IsSetTo2InBatch(d.getRight(),d.getBottom())||this._uSrcOriginStart.IsUsed()&&!this._uSrcOriginStart.IsSetTo2InBatch(c.getLeft(),c.getTop())||this._uSrcOriginEnd.IsUsed()&&!this._uSrcOriginEnd.IsSetTo2InBatch(c.getRight(),c.getBottom())||this._uLayoutStart.IsUsed()&&
!this._uLayoutStart.IsSetTo2InBatch(f.getLeft(),f.getTop())||this._uLayoutEnd.IsUsed()&&!this._uLayoutEnd.IsSetTo2InBatch(f.getTop(),f.getBottom())||this._uSeconds.IsUsed()&&!this._uSeconds.IsSetTo1InBatch(w)?!1:!0}SetOptionalUniformsInBatch(a,d,c,f,h,g,l,m,u,w){this._uSamplerBack.IsUsed()||(this._uPixelSize.IsUsed()&&this._uPixelSize.SetBatch2(h,g),this._uDestStart.IsUsed()&&this._uDestStart.SetBatch2(a.getLeft(),a.getTop()),this._uDestEnd.IsUsed()&&this._uDestEnd.SetBatch2(a.getRight(),a.getBottom()),
this._uDevicePixelRatio.IsUsed()&&this._uDevicePixelRatio.SetBatch1(l),this._uLayerScale.IsUsed()&&this._uLayerScale.SetBatch1(m),this._uLayerAngle.IsUsed()&&this._uLayerAngle.SetBatch1(u),this._uSrcStart.IsUsed()&&this._uSrcStart.SetBatch2(d.getLeft(),d.getTop()),this._uSrcEnd.IsUsed()&&this._uSrcEnd.SetBatch2(d.getRight(),d.getBottom()),this._uSrcOriginStart.IsUsed()&&this._uSrcOriginStart.SetBatch2(c.getLeft(),c.getTop()),this._uSrcOriginEnd.IsUsed()&&this._uSrcOriginEnd.SetBatch2(c.getRight(),
c.getBottom()),this._uLayoutStart.IsUsed()&&this._uLayoutStart.SetBatch2(f.getLeft(),f.getTop()),this._uLayoutEnd.IsUsed()&&this._uLayoutEnd.SetBatch2(f.getTop(),f.getBottom()),this._uSeconds.IsUsed()&&this._uSeconds.SetBatch1(w))}UpdateMatP(a,d){this._hasCurrentMatP&&!d||this._isDeviceTransform||(this._uMatP.IsUsed()&&this._uMatP.UpdateMatrix4fv(a),this._hasCurrentMatP=!0)}SetMatPStale(){this._hasCurrentMatP=!1}UpdateMatMV(a,d){this._hasCurrentMatMV&&!d||this._isDeviceTransform||(this._uMatMV.IsUsed()&&
this._uMatMV.UpdateMatrix4fv(a),this._hasCurrentMatMV=!0)}SetMatMVStale(){this._hasCurrentMatMV=!1}_UpdateDeviceTransformUniforms(a){if(!this._isDeviceTransform)throw Error("not device transform shader");this._uMatP.UpdateMatrix4fv(a);a=this._renderer;const d=a.GetWidth()/2,c=a.GetHeight()/2;a=a.CalculateLookAtModelView2(d,c,a.GetDefaultCameraZ(a.GetHeight()),d,c,0,a.GetHeight());this._uMatMV.UpdateMatrix4fv(a)}UpdateColor(a){this._uColor.IsUsed()&&this._uColor.Update4f(a[0],a[1],a[2],a[3])}static GetReservedUniformNames(){return b}static GetDefaultVertexShaderSource(a){a=
a?"highmedp":"mediump";return["#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nattribute highp vec3 aPos;",`attribute ${a} vec2 aTex;`,`varying ${a} vec2 vTex;`,"uniform highp mat4 matP;\nuniform highp mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPos, 1.0);\n\tvTex = aTex;\n}"].join("\n")}static GetTextureFillFragmentShaderSource_WebGL1_NoFragDepth(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, vTex) * color;\n}"}static GetTextureFillFragmentShaderSource_WebGL1_FragDepthEXT(){return"#extension GL_EXT_frag_depth : enable\nvarying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, vTex) * color;\n\tgl_FragDepthEXT = (gl_FragColor.a == 0.0 ? 1.0 : gl_FragCoord.z);\n}"}static GetDefaultVertexShaderSource_WebGL2(){return"#version 300 es\nin highp vec3 aPos;\nin mediump vec2 aTex;\nout mediump vec2 vTex;\nuniform highp mat4 matP;\nuniform highp mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPos, 1.0);\n\tvTex = aTex;\n}"}static GetTextureFillFragmentShaderSource_WebGL2(){return"#version 300 es\nin mediump vec2 vTex;\nout lowp vec4 outColor;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nvoid main(void) {\n\toutColor = texture(samplerFront, vTex) * color;\n\tgl_FragDepth = (outColor.a == 0.0 ? 1.0 : gl_FragCoord.z);\n}"}static GetTilemapFragmentShaderSource(){return"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nvarying highmedp vec2 vTex;\nuniform lowp vec4 color;\nuniform lowp sampler2D samplerFront;\nuniform highmedp vec2 srcStart;\nuniform highmedp vec2 pixelSize;\nuniform highmedp vec2 tileSize;\nuniform highmedp vec2 tileSpacing;\nvoid main(void) {\n\thighmedp vec2 tile = floor(vTex);\n\thighmedp vec2 tex = fract(vTex);\n\thighmedp vec2 tileOrigin = srcStart + tile * (tileSize + tileSpacing);\n\thighmedp vec2 lowerBound = tileOrigin + pixelSize / 2.0;\n\thighmedp vec2 upperBound = tileOrigin + tileSize - pixelSize / 2.0;\n\tgl_FragColor = texture2D(samplerFront, clamp(tex, lowerBound, upperBound), -16.0) * color;\n}"}static GetPointVertexShaderSource(a){return e.Gfx.WebGLShaderProgram.GetPointVertexShaderSource_WebGL1()}static GetPointFragmentShaderSource(a){return e.Gfx.WebGLShaderProgram.GetPointFragmentShaderSource_WebGL1()}static GetPointVertexShaderSource_WebGL1(){return"attribute vec4 aPoints;\nvarying float pointOpacity;\nuniform float zElevation;\nuniform mat4 matP;\nuniform mat4 matMV;\nvoid main(void) {\n\tgl_Position = matP * matMV * vec4(aPoints.xy, zElevation, 1.0);\n\tgl_PointSize = aPoints.z;\n\tpointOpacity = aPoints.w;\n}"}static GetPointFragmentShaderSource_WebGL1(){return"uniform lowp sampler2D samplerFront;\nvarying lowp float pointOpacity;\nuniform mediump vec2 pointTexStart;\nuniform mediump vec2 pointTexEnd;\nuniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = texture2D(samplerFront, mix(pointTexStart, pointTexEnd, gl_PointCoord)) * color * pointOpacity;\n}"}static GetColorFillFragmentShaderSource(){return"uniform lowp vec4 color;\nvoid main(void) {\n\tgl_FragColor = color;\n}"}static GetLinearGradientFillFragmentShaderSource(){return"precision lowp float;\nvarying mediump vec2 vTex;\nuniform vec4 color;\nuniform vec4 color2_;\nvec3 fromLinear(vec3 linearRGB)\n{\n\tbvec3 cutoff = lessThan(linearRGB, vec3(0.0031308));\n\tvec3 higher = vec3(1.055) * pow(abs(linearRGB), vec3(1.0/2.4)) - vec3(0.055);\n\tvec3 lower = linearRGB * vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvec3 toLinear(vec3 sRGB)\n{\n\tbvec3 cutoff = lessThan(sRGB, vec3(0.04045));\n\tvec3 higher = pow(abs((sRGB + vec3(0.055))/vec3(1.055)), vec3(2.4));\n\tvec3 lower = sRGB/vec3(12.92);\n\treturn mix(higher, lower, vec3(cutoff));\n}\nvoid main(void) {\n\tvec3 linearGrad = mix(toLinear(color.rgb), toLinear(color2_.rgb), vTex.x);\n\tfloat a = mix(color.a, color2_.a, vTex.x);\n\tgl_FragColor = vec4(fromLinear(linearGrad) * a, a);\n}"}static GetSmoothLineFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tlowp float f = 1.0 - abs(vTex.y - 0.5) * 2.0;\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float f = step(diffSq.x + diffSq.y, 0.25);\n\tgl_FragColor = color * f;\n}"}static GetHardEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump float innerF = step(distSq, 0.25);\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm * outlineThickness;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float outerF = step(innerEdgeSq.x + innerEdgeSq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}static GetSmoothEllipseFillFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 innerEdge = halfNorm - pixelSize * norm;\n\tmediump vec2 innerEdgeSq = innerEdge * innerEdge;\n\tmediump float f = smoothstep(halfNormSq.x + halfNormSq.y, innerEdgeSq.x + innerEdgeSq.y, diffSq.x + diffSq.y);\n\tgl_FragColor = color * f;\n}"}static GetSmoothEllipseOutlineFragmentShaderSource(){return"varying mediump vec2 vTex;\nuniform lowp vec4 color;\nuniform mediump vec2 pixelSize;\nuniform mediump float outlineThickness;\nvoid main(void) {\n\tmediump vec2 diff = vTex - vec2(0.5, 0.5);\n\tmediump vec2 diffSq = diff * diff;\n\tmediump float distSq = diffSq.x + diffSq.y;\n\tmediump vec2 norm = normalize(diff);\n\tmediump vec2 halfNorm = norm * 0.5;\n\tmediump vec2 halfNormSq = halfNorm * halfNorm;\n\tmediump vec2 pxNorm = pixelSize * norm;\n\tmediump vec2 innerEdge1 = halfNorm - pxNorm;\n\tmediump vec2 innerEdge1Sq = innerEdge1 * innerEdge1;\n\tmediump float innerF = smoothstep(halfNormSq.x + halfNormSq.y, innerEdge1Sq.x + innerEdge1Sq.y, distSq);\n\tmediump vec2 innerEdge2 = halfNorm - pxNorm * outlineThickness;\n\tmediump vec2 innerEdge2Sq = innerEdge2 * innerEdge2;\n\tmediump vec2 innerEdge3 = halfNorm - pxNorm * (outlineThickness + 1.0);\n\tmediump vec2 innerEdge3Sq = innerEdge3 * innerEdge3;\n\tmediump float outerF = smoothstep(innerEdge3Sq.x + innerEdge3Sq.y, innerEdge2Sq.x + innerEdge2Sq.y, distSq);\n\tgl_FragColor = color * innerF * outerF;\n}"}}}
{"use strict";const e=self.C3,b=self.glMatrix.mat4,a=new Map([["float",1],["percent",1],["sampler",1],["vec2",2],["vec3",3],["color",3],["vec4",4],["mat4",16]]);e.Gfx.WebGLShaderUniform=class{constructor(d,c,f){if(!a.has(f))throw Error("invalid uniform type");this._owner=d;this._gl=this._owner.GetWebGLContext();this._name=c;this._type=f;this._isColorType="color"===this._type;this._location=this._gl.getUniformLocation(this._owner.GetShaderProgram(),c);this._isUsed=!!this._location;d=a.get(f);this._lastValue=
new Float32Array(d);this._lastBatchValue=new Float32Array(d)}Release(){this._location=this._gl=this._owner=null}IsUsed(){return this._isUsed}GetType(){return this._type}IsColorType(){return this._isColorType}Init1f(d){this.IsUsed()&&(this._lastValue[0]=d,this._lastBatchValue.set(this._lastValue),this._gl.uniform1f(this._location,d))}Init1i(d){this.IsUsed()&&(this._lastValue[0]=d,this._lastBatchValue.set(this._lastValue),this._gl.uniform1i(this._location,d))}Init2f(d,c){this.IsUsed()&&(this._lastValue[0]=
d,this._lastValue[1]=c,this._lastBatchValue.set(this._lastValue),this._gl.uniform2f(this._location,d,c))}Init3f(d,c,f){this.IsUsed()&&(this._lastValue[0]=d,this._lastValue[1]=c,this._lastValue[2]=f,this._lastBatchValue.set(this._lastValue),this._gl.uniform3f(this._location,d,c,f))}Init4f(d,c,f,h){this.IsUsed()&&(this._lastValue[0]=d,this._lastValue[1]=c,this._lastValue[2]=f,this._lastValue[3]=h,this._lastBatchValue.set(this._lastValue),this._gl.uniform4f(this._location,d,c,f,h))}Update1f(d){d=Math.fround(d);
const c=this._lastValue;c[0]!==d&&(c[0]=d,this._gl.uniform1f(this._location,d))}Update1i(d){const c=this._lastValue;c[0]!==d&&(c[0]=d,this._gl.uniform1i(this._location,d))}Update2f(d,c){d=Math.fround(d);c=Math.fround(c);const f=this._lastValue;if(f[0]!==d||f[1]!==c)f[0]=d,f[1]=c,this._gl.uniform2f(this._location,d,c)}Update3f(d,c,f){d=Math.fround(d);c=Math.fround(c);f=Math.fround(f);const h=this._lastValue;if(h[0]!==d||h[1]!==c||h[2]!==f)h[0]=d,h[1]=c,h[2]=f,this._gl.uniform3f(this._location,d,c,
f)}Update4f(d,c,f,h){d=Math.fround(d);c=Math.fround(c);f=Math.fround(f);h=Math.fround(h);const g=this._lastValue;if(g[0]!==d||g[1]!==c||g[2]!==f||g[3]!==h)g[0]=d,g[1]=c,g[2]=f,g[3]=h,this._gl.uniform4f(this._location,d,c,f,h)}UpdateMatrix4fv(d){const c=this._lastValue;b.exactEquals(c,d)||(e.typedArraySet16(c,d,0),this._gl.uniformMatrix4fv(this._location,!1,d))}IsSetToCustomInBatch(d){const c=this._lastBatchValue;return this.IsColorType()?c[0]===Math.fround(d.getR())&&c[1]===Math.fround(d.getG())&&
c[2]===Math.fround(d.getB()):c[0]===Math.fround(d)}SetBatchValueCustom(d){const c=this._lastBatchValue;this.IsColorType()?(c[0]=d.getR(),c[1]=d.getG(),c[2]=d.getB()):c[0]=d}IsSetTo1InBatch(d){return this._lastBatchValue[0]===Math.fround(d)}IsSetTo2InBatch(d,c){const f=this._lastBatchValue;return f[0]===Math.fround(d)&&f[1]===Math.fround(c)}SetBatch1(d){this._lastBatchValue[0]=d}SetBatch2(d,c){const f=this._lastBatchValue;f[0]=d;f[1]=c}}}
{"use strict";const e=self.C3,b=self.glMatrix,a=b.vec4,d=b.mat4;e.Gfx.BatchState=class{constructor(c){this.renderer=c;this.currentMV=d.create();this.currentMatP=d.create();this.currentFramebufferNoDepth=this.currentFramebuffer=null;this.isDepthSamplingEnabled=!1;this.currentColor=a.fromValues(1,1,1,1);this.currentShader=null;this.pointTexCoords=new e.Rect;this.clearColor=e.New(e.Color,0,0,0,0)}};e.Gfx.WebGLBatchJob=class{constructor(c){const f=new ArrayBuffer(96);this._type=0;this._batchState=c;this._gl=
c.renderer.GetContext();this._indexCount=this._startIndex=0;this._texParam=null;this._mat4param=new Float32Array(f,0,16);this._colorParam=new Float32Array(f,64,4);this._srcOriginRect=new Float32Array(f,80,4);this._shaderParams=[]}InitQuad(c,f){this._type=1;this._startIndex=c;this._indexCount=f}DoQuad(){const c=this._gl;c.drawElements(c.TRIANGLES,this._indexCount,c.UNSIGNED_SHORT,this._startIndex)}InitSetTexture(c){this._type=2;this._texParam=c}DoSetTexture(){const c=this._gl,f=this._texParam;c.bindTexture(c.TEXTURE_2D,
f?f._GetTexture():null)}InitSetColor(c){this._type=3;c.writeToTypedArray(this._colorParam,0)}DoSetColor(){const c=this._colorParam,f=this._batchState;a.copy(f.currentColor,c);f.currentShader.UpdateColor(c)}InitSetGradientColor(c){this._type=20;c.writeToTypedArray(this._colorParam,0)}DoSetGradientColor(){const c=this._colorParam,f=this._batchState.currentShader;f._uColor2.IsUsed()&&f._uColor2.Update4f(c[0],c[1],c[2],c[3])}InitSetBlend(c,f){this._type=4;this._startIndex=c;this._indexCount=f}DoSetBlend(){this._gl.blendFunc(this._startIndex,
this._indexCount)}InitSetViewport(c,f,h,g){this._type=5;const l=this._colorParam;l[0]=c;l[1]=f;l[2]=h;l[3]=g}DoSetViewport(){const c=this._colorParam;this._gl.viewport(c[0],c[1],c[2],c[3])}InitSetProjection(c){this._type=6;d.copy(this._mat4param,c)}DoSetProjection(){const c=this._batchState,f=c.renderer._allShaderPrograms,h=c.currentShader,g=this._mat4param;for(let l=0,m=f.length;l<m;++l){const u=f[l];u===h?u.UpdateMatP(g,!0):u.SetMatPStale()}d.copy(c.currentMatP,g)}InitSetModelView(c){this._type=
7;d.copy(this._mat4param,c)}DoSetModelView(){const c=this._batchState,f=c.renderer._allShaderPrograms,h=c.currentShader,g=this._mat4param;for(let l=0,m=f.length;l<m;++l){const u=f[l];u===h?u.UpdateMatMV(g,!0):u.SetMatMVStale()}d.copy(c.currentMV,g)}InitSetRenderTarget(c){this._type=8;this._texParam=c}DoSetRenderTarget(){const c=this._gl,f=this._texParam,h=this._batchState;f?(h.currentFramebuffer=f._GetFramebuffer(),h.currentFramebufferNoDepth=f._GetFramebufferNoDepth(),h.isDepthSamplingEnabled&&h.currentFramebufferNoDepth?
c.bindFramebuffer(c.FRAMEBUFFER,h.currentFramebufferNoDepth):c.bindFramebuffer(c.FRAMEBUFFER,h.currentFramebuffer)):(h.currentFramebuffer=null,h.currentFramebufferNoDepth=null,c.bindFramebuffer(c.FRAMEBUFFER,null))}InitClearSurface(c){this._type=9;c.writeToTypedArray(this._mat4param,0)}InitClearSurface2(c,f,h,g){this._type=9;const l=this._mat4param;l[0]=c;l[1]=f;l[2]=h;l[3]=g}DoClearSurface(){const c=this._gl;var f=this._mat4param;const h=this._batchState.clearColor,g=f[0],l=f[1],m=f[2];f=f[3];h.equalsRgba(g,
l,m,f)||(c.clearColor(g,l,m,f),h.setRgba(g,l,m,f));c.clear(c.COLOR_BUFFER_BIT)}InitSetPointTexCoords(c){this._type=14;c.writeToTypedArray(this._mat4param,0)}DoSetPointTextureCoords(){const c=this._mat4param;this._batchState.pointTexCoords.set(c[0],c[1],c[2],c[3])}InitPoints(c,f){this._type=10;this._startIndex=c;this._indexCount=1;this._mat4param[0]=f}DoPoints(){const c=this._gl,f=this._batchState,h=f.renderer._spPoints;c.useProgram(h._shaderProgram);h.UpdateMatP(f.currentMatP,!1);h.UpdateMatMV(f.currentMV,
!1);var g=f.pointTexCoords;h._uPointTexStart.IsUsed()&&h._uPointTexStart.Update2f(g.getLeft(),g.getTop());h._uPointTexEnd.IsUsed()&&h._uPointTexEnd.Update2f(g.getRight(),g.getBottom());g=this._mat4param[0];h._uZElevation.IsUsed()&&h._uZElevation.Update1f(g);h._uColor.IsUsed()&&(g=f.currentColor,h._uColor.Update4f(g[0],g[1],g[2],g[3]));c.drawArrays(c.POINTS,this._startIndex/4,this._indexCount);c.useProgram(f.currentShader._shaderProgram)}InitSetProgram(c){this._type=11;this._texParam=c}DoSetProgram(){var c=
this._gl;const f=this._batchState,h=this._texParam;f.currentShader=h;c.useProgram(h._shaderProgram);h.UpdateMatP(f.currentMatP,!1);h.UpdateMatMV(f.currentMV,!1);h._uColor.IsUsed()&&(c=f.currentColor,h._uColor.Update4f(c[0],c[1],c[2],c[3]))}InitSetProgramParameters(){this._type=12}DoSetProgramParameters(){const c=this._batchState.currentShader;c._hasAnyOptionalUniforms&&this._DoSetOptionalUniformProgramParameters(c);c._uCustomParameters.length&&this._DoUpdateCustomProgramParameters(c)}_DoSetOptionalUniformProgramParameters(c){const f=
this._gl,h=this._mat4param,g=this._colorParam,l=this._srcOriginRect;if(c._uSamplerBack.IsUsed()){const m=this._batchState.renderer,u=this._texParam;m._lastTexture1!==u&&(f.activeTexture(f.TEXTURE1),f.bindTexture(f.TEXTURE_2D,u?u._GetTexture():null),m._lastTexture1=u,f.activeTexture(f.TEXTURE0))}c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(h[0],h[1]);c._uDestStart.IsUsed()&&c._uDestStart.Update2f(h[2],h[3]);c._uDestEnd.IsUsed()&&c._uDestEnd.Update2f(h[4],h[5]);c._uDevicePixelRatio.IsUsed()&&c._uDevicePixelRatio.Update1f(this._indexCount);
c._uLayerScale.IsUsed()&&c._uLayerScale.Update1f(h[6]);c._uLayerAngle.IsUsed()&&c._uLayerAngle.Update1f(h[7]);c._uSrcStart.IsUsed()&&c._uSrcStart.Update2f(h[12],h[13]);c._uSrcEnd.IsUsed()&&c._uSrcEnd.Update2f(h[14],h[15]);c._uSrcOriginStart.IsUsed()&&c._uSrcOriginStart.Update2f(l[0],l[1]);c._uSrcOriginEnd.IsUsed()&&c._uSrcOriginEnd.Update2f(l[2],l[3]);c._uLayoutStart.IsUsed()&&c._uLayoutStart.Update2f(g[0],g[1]);c._uLayoutEnd.IsUsed()&&c._uLayoutEnd.Update2f(g[2],g[3]);c._uSeconds.IsUsed()&&c._uSeconds.Update1f(this._startIndex)}_DoUpdateCustomProgramParameters(c){c=
c._uCustomParameters;const f=this._shaderParams;for(let h=0,g=c.length;h<g;++h){const l=c[h],m=f[h];l.IsColorType()?l.Update3f(m.getR(),m.getG(),m.getB()):l.Update1f(m)}}InitInvalidateFramebuffer(c){this._type=13;this._texParam=c}DoInvalidateFramebuffer(){const c=this._gl,f=this._texParam,h=this._batchState.currentFramebuffer;f!==h&&c.bindFramebuffer(c.FRAMEBUFFER,f);c.invalidateFramebuffer(c.FRAMEBUFFER,[c.COLOR_ATTACHMENT0]);f!==h&&c.bindFramebuffer(c.FRAMEBUFFER,h)}InitBlitFramebuffer(c,f,h){this._type=
16;const g=this._mat4param,l=this._batchState.renderer;g[0]=c.GetWidth();g[1]=c.GetHeight();g[2]=f?f.GetWidth():l.GetWidth();g[3]=f?f.GetHeight():l.GetHeight();g[4]=c.IsLinearSampling()?1:0;g[5]="stretch"===h;h=this._shaderParams;e.clearArray(h);h.push(c._GetFramebuffer());h.push(f?f._GetFramebuffer():null)}DoBlitFramebuffer(){var c=this._mat4param,f=this._shaderParams;const h=this._gl;var g=c[0],l=c[1],m=c[2];const u=c[3],w=0!==c[4];c=0!==c[5];const q=f[1];h.bindFramebuffer(h.READ_FRAMEBUFFER,f[0]);
h.bindFramebuffer(h.DRAW_FRAMEBUFFER,q);c?h.blitFramebuffer(0,0,g,l,0,0,m,u,h.COLOR_BUFFER_BIT,w?h.LINEAR:h.NEAREST):(f=Math.min(g,m),g=Math.min(l,u),m=Math.max(l-u,0),l=Math.max(u-l,0),h.blitFramebuffer(0,m,f,g+m,0,l,f,g+l,h.COLOR_BUFFER_BIT,h.NEAREST))}InitStartQuery(c){this._type=17;this._texParam=c}DoStartQuery(){this._texParam.BeginTimeElapsed();this._texParam=null}InitEndQuery(c){this._type=18;this._texParam=c}DoEndQuery(){this._texParam.EndTimeElapsed();this._texParam=null}InitSetEllipseParams(c,
f,h){this._type=19;const g=this._mat4param;g[0]=c;g[1]=f;g[2]=h}DoSetEllipseParams(){const c=this._batchState.currentShader,f=this._mat4param;c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(f[0],f[1]);c._uOutlineThickness.IsUsed()&&c._uOutlineThickness.Update1f(f[2])}InitSetTilemapInfo(c,f,h,g,l,m,u){this._type=15;const w=this._mat4param;c.writeToTypedArray(w,0);w[4]=1/f;w[5]=1/h;w[6]=g/f;w[7]=l/h;w[8]=m/f;w[9]=u/h}DoSetTilemapInfo(){const c=this._batchState.currentShader,f=this._mat4param;c._uSrcStart.IsUsed()&&
c._uSrcStart.Update2f(f[0],f[1]);c._uPixelSize.IsUsed()&&c._uPixelSize.Update2f(f[4],f[5]);c._uTileSize.IsUsed()&&c._uTileSize.Update2f(f[6],f[7]);c._uTileSpacing.IsUsed()&&c._uTileSpacing.Update2f(f[8],f[9])}InitClearDepth(c){this._type=21;this._startIndex=c?1:0}DoClearDepth(){const c=this._gl,f=0!==this._startIndex;f||c.depthMask(!0);c.clear(c.DEPTH_BUFFER_BIT);f||c.depthMask(!1)}InitSetDepthEnabled(c){this._type=22;this._startIndex=c?1:0}DoSetDepthEnabled(){const c=this._gl;0===this._startIndex?
(c.disable(c.DEPTH_TEST),c.depthMask(!1)):(c.enable(c.DEPTH_TEST),c.depthMask(!0))}InitSetDepthSamplingEnabled(c){this._type=23;this._startIndex=c?1:0}DoSetDepthSamplingEnabled(){const c=this._gl,f=this._batchState,h=f.renderer,g=0!==this._startIndex;f.isDepthSamplingEnabled=g;c.activeTexture(c.TEXTURE2);g?(f.currentFramebufferNoDepth&&c.bindFramebuffer(c.FRAMEBUFFER,f.currentFramebufferNoDepth),c.bindTexture(c.TEXTURE_2D,h._GetDepthBuffer())):(c.bindTexture(c.TEXTURE_2D,null),f.currentFramebufferNoDepth&&
c.bindFramebuffer(c.FRAMEBUFFER,f.currentFramebuffer));c.activeTexture(c.TEXTURE0)}InitCoplanarStartStencilPass(){this._type=24}DoCoplanarStartStencilPass(){const c=this._gl;c.clear(c.STENCIL_BUFFER_BIT);c.enable(c.STENCIL_TEST);c.stencilFunc(c.ALWAYS,1,1);c.stencilOp(c.KEEP,c.KEEP,c.REPLACE);c.colorMask(!1,!1,!1,!1)}InitCoplanarStartColorPass(){this._type=25}DoCoplanarStartColorPass(){const c=this._gl;c.colorMask(!0,!0,!0,!0);c.stencilFunc(c.EQUAL,1,1);c.stencilOp(c.KEEP,c.KEEP,c.KEEP)}InitCoplanarRestore(){this._type=
26}DoCoplanarRestore(){const c=this._gl;c.disable(c.STENCIL_TEST)}InitSetScissor(c,f,h,g,l){this._type=27;this._startIndex=c?1:0;c=this._mat4param;c[0]=f;c[1]=h;c[2]=g;c[3]=l}DoSetScissor(){const c=this._gl,f=this._mat4param;1===this._startIndex?(c.enable(c.SCISSOR_TEST),c.scissor(f[0],f[1],f[2],f[3])):c.disable(c.SCISSOR_TEST)}Run(){switch(this._type){case 1:this.DoQuad();break;case 2:this.DoSetTexture();break;case 3:this.DoSetColor();break;case 4:this.DoSetBlend();break;case 5:this.DoSetViewport();
break;case 6:this.DoSetProjection();break;case 7:this.DoSetModelView();break;case 8:this.DoSetRenderTarget();break;case 9:this.DoClearSurface();break;case 10:this.DoPoints();break;case 11:this.DoSetProgram();break;case 12:this.DoSetProgramParameters();break;case 13:this.DoInvalidateFramebuffer();break;case 14:this.DoSetPointTextureCoords();break;case 15:this.DoSetTilemapInfo();break;case 16:this.DoBlitFramebuffer();break;case 17:this.DoStartQuery();break;case 18:this.DoEndQuery();break;case 19:this.DoSetEllipseParams();
break;case 20:this.DoSetGradientColor();break;case 21:this.DoClearDepth();break;case 22:this.DoSetDepthEnabled();break;case 23:this.DoSetDepthSamplingEnabled();break;case 24:this.DoCoplanarStartStencilPass();break;case 25:this.DoCoplanarStartColorPass();break;case 26:this.DoCoplanarRestore();break;case 27:this.DoSetScissor()}}}}
{"use strict";const e=self.C3,b={timeout:60},a=new e.Color(0,0,0,1),d=new Set(["left","center","right"]),c=new Set(["top","center","bottom"]),f=new Set(["word","character"]),h=new Set;e.FontManager&&e.FontManager.addEventListener("fontload",q=>{q=q.font.GetName();for(const t of h)(t.IsBBCodeEnabled()||e.equalsNoCase(t.GetFontName(),q))&&t._SetTextChanged()});function g(q,t,p,r,x,y){t?"Gecko"===e.Platform.BrowserEngine?q.strokeText(p,r,x,y):q.strokeText(p,r,x):"Gecko"===e.Platform.BrowserEngine?q.fillText(p,
r,x,y):q.fillText(p,r,x)}function l(q,t,p,r,x,y){t?q.strokeRect(p,r,x,y):q.fillRect(p,r,x,y)}function m(q){return 4/3*q}let u=!1,w=!1;e.Gfx.RendererText=class{constructor(q,t){t=Object.assign({},b,t);this._renderer=q;this._fontName="Arial";this._fontSize=16;this._fontSizeScale=1;this._lineHeight=0;this._isItalic=this._isBold=!1;this._colorStr="black";this._isBBcodeEnabled=!1;this.onloadfont=null;this._alreadyLoadedFonts=new Set;this._horizontalAlign="left";this._verticalAlign="top";this._text="";
this._bbString=null;this._wrappedText=e.New(e.WordWrap);this._wrapMode="word";this._isUpdating=this._textChanged=!1;this._isAsync=!0;this._drawMaxCharCount=-1;this._height=this._width=this._cssHeight=this._cssWidth=this._drawCharCount=0;this._zoom=1;this._changed=!1;this._measureContextTop=this._measureContext=this._textContext=this._textCanvas=null;this._lastCanvasHeight=this._lastCanvasWidth=-1;this._lastTextCanvasFillStyle=this._lastMeasureCanvasFont=this._lastTextCanvasFont="";this._lastTextCanvasLineWidth=
this._lastTextCanvasOpacity=1;this._measureTextCallback=(p,r)=>this._MeasureText(p,r);this._texture=null;this._textureHeight=this._textureWidth=0;this._rcTex=new e.Rect;this._scaleFactor=1;this._needToRecreateTexture=!1;this._textureTimeout=new e.IdleTimeout(()=>{this.ReleaseTexture();this._SetTextCanvasSize(8,8)},t.timeout);this.ontextureupdate=null;this._wasReleased=!1;h.add(this)}Release(){this.onloadfont=null;this._alreadyLoadedFonts.clear();this._measureTextCallback=this._measureContextTop=this._measureContext=
this._textContext=this._textCanvas=this._bbString=null;this._textureTimeout.Release();this.ontextureupdate=null;this.ReleaseTexture();this._wrappedText.Clear();this._renderer=this._wrappedText=null;this._wasReleased=!0;h.delete(this)}_SetChanged(){this._changed=!0}_SetTextChanged(){this._SetChanged();this._wrappedText.Clear();this._textChanged=!0}SetIsAsync(q){this._isAsync=!!q}IsAsync(){return this._isAsync}SetBBCodeEnabled(q){q=!!q;this._isBBcodeEnabled!==q&&(q=(this._isBBcodeEnabled=q)?"alphabetic":
"top",this._textContext&&(this._textContext.textBaseline=q),this._measureContext&&(this._measureContext.textBaseline=q),this._SetTextChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetFontName(q){q||(q="serif");this._fontName!==q&&(this._fontName=q,this._SetTextChanged())}GetFontName(){return this._fontName}SetFontSize(q){.1>q&&(q=.1);this._fontSize!==q&&(this._fontSize=q,this._SetTextChanged())}SetFontSizeScale(q){this._fontSizeScale!==q&&(this._fontSizeScale=q,this._SetTextChanged())}SetLineHeight(q){this._lineHeight!==
q&&(this._lineHeight=q,this._SetChanged())}SetBold(q){q=!!q;this._isBold!==q&&(this._isBold=q,this._SetTextChanged())}SetItalic(q){q=!!q;this._isItalic!==q&&(this._isItalic=q,this._SetTextChanged())}SetDrawMaxCharacterCount(q){q=Math.floor(q);this._drawMaxCharCount!==q&&(this._drawMaxCharCount=q,this._SetChanged())}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(q,t){for(let p=q.length-1;0<=p;--p){const r=q[p];if(r.tag===t)return r}return null}_HasStyleTag(q,t){return!!this._GetStyleTag(q,
t)}_GetFontString(q,t){let p=[];(this._isBold||this._HasStyleTag(t,"b"))&&p.push("bold");(this._isItalic||this._HasStyleTag(t,"i"))&&p.push("italic");var r=this._GetStyleTag(t,"size");r=(r?parseFloat(r.param):this._fontSize)*this._fontSizeScale;q?p.push(r+"pt"):p.push(r*this._scaleFactor*this._zoom*self.devicePixelRatio+"pt");q=this._fontName;(t=this._GetStyleTag(t,"font"))&&t.param&&(q=t.param,this.onloadfont&&!this._alreadyLoadedFonts.has(q)&&(this.onloadfont(q),this._alreadyLoadedFonts.add(q)));
q&&p.push('"'+q+'"');return p.join(" ")}SetColor(q){q instanceof e.Color&&(q=q.getCssRgb());this._colorStr!==q&&(this._colorStr=q,this._SetChanged())}SetColorRgb(q,t,p){a.setRgb(q,t,p);this.SetColor(a)}SetHorizontalAlignment(q){if(!d.has(q))throw Error("invalid horizontal alignment");this._horizontalAlign!==q&&(this._horizontalAlign=q,this._SetChanged())}SetVerticalAlignment(q){if(!c.has(q))throw Error("invalid vertical alignment");this._verticalAlign!==q&&(this._verticalAlign=q,this._SetChanged())}SetWordWrapMode(q){if(!f.has(q))throw Error("invalid word wrap mode");
this._wrapMode!==q&&(this._wrapMode=q,this._SetTextChanged())}SetText(q){this._text!==q&&(this._text=q,this._SetTextChanged())}SetSize(q,t,p){"undefined"===typeof p&&(p=1);if(!(0>=q||0>=q||this._cssWidth===q&&this._cssHeight===t&&this._zoom===p)){1===this._zoom!==(1===p)&&(this._needToRecreateTexture=!0);var r=this._cssWidth,x=this._zoom;this._cssWidth=q;this._cssHeight=t;this._zoom=p;q=self.devicePixelRatio;this._width=this._cssWidth*this._zoom*q;this._height=this._cssHeight*this._zoom*q;q=Math.max(this._width,
this._height);t=Math.min(this._renderer.GetMaxTextureSize(),4096);p=1;q>t&&(p=t/q,this._width=Math.min(this._width*p,t),this._height=Math.min(this._height*p,t));this._scaleFactor=p;0<this._textureWidth&&0<this._textureHeight&&this._zoom===x&&this._rcTex.set(0,0,this._width/this._textureWidth,this._height/this._textureHeight);this._cssWidth!==r?this._SetTextChanged():this._SetChanged()}}GetWidth(){return this._width}GetHeight(){return this._height}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();
return this._wrappedText.GetTotalLineHeight()+this._wrappedText.GetLineCount()*(this._lineHeight+4)-this._lineHeight}GetTexture(){this._textureTimeout.Reset();this._MaybeUpdate();return this._texture}_MaybeUpdate(){this._texture&&!this._changed&&!this._textChanged||this._isUpdating||0>=this._width||0>=this._height||(this._changed=!1,this._isUpdating=!0,this._isAsync?e.Asyncify(()=>this._DoUpdate()):this._DoUpdate())}_DoUpdate(){this._wasReleased||(this._SetTextCanvasSize(Math.ceil(this._width),Math.ceil(this._height)),
this._MaybeWrapText(),this._DrawTextToCanvas(),this._UpdateTexture(),this._textureTimeout.Reset(),this._isUpdating=!1)}_SetTextCanvasSize(q,t){this._textCanvas||(this._textCanvas=e.CreateCanvas(16,16));let p=!1;if(this._lastCanvasWidth!==q||this._lastCanvasHeight!==t)this._lastCanvasWidth=q,this._lastCanvasHeight=t,this._textCanvas.width=q,this._textCanvas.height=t,p=!0;this._textContext||(this._textContext=this._textCanvas.getContext("2d"),p=!0);p?(this._textContext.textBaseline=this._isBBcodeEnabled?
"alphabetic":"top",this._textContext.font=this._lastTextCanvasFont,this._textContext.fillStyle=this._lastTextCanvasFillStyle,this._textContext.strokeStyle=this._lastTextCanvasFillStyle,this._textContext.globalAlpha=this._lastTextCanvasOpacity,this._textContext.lineWidth=this._lastTextCanvasLineWidth):this._textContext.clearRect(0,0,q,t)}_MaybeCreateMeasureContext(){this._measureContext||(this._measureContext=e.CreateCanvas(16,16).getContext("2d"),this._measureContextTop=e.CreateCanvas(16,16).getContext("2d"),
this._measureContext.textBaseline=this._isBBcodeEnabled?"alphabetic":"top",this._measureContextTop.textBaseline="top")}_SetMeasureFontString(q){this._lastMeasureCanvasFont!==q&&(this._lastMeasureCanvasFont=q,this._measureContext.font=q,this._measureContextTop.font=q)}_SupportsFontBoundingBoxMeasurements(){if(!u){u=!0;this._MaybeCreateMeasureContext();const q=this._measureContext.measureText("test");w="number"===typeof q.fontBoundingBoxAscent&&"number"===typeof q.fontBoundingBoxDescent}return w}_MaybeWrapText(){this._textChanged&&
(this._MaybeCreateMeasureContext(),!this._isBBcodeEnabled||this._bbString&&this._bbString.toString()===this._text||(this._bbString=new e.BBString(this._text,{noEscape:!0})),this._wrappedText.WordWrap(this._isBBcodeEnabled?this._bbString.toFragmentList():this._text,this._measureTextCallback,this._cssWidth,this._wrapMode,0),this._textChanged=!1)}_MeasureText(q,t){this._SetMeasureFontString(this._GetFontString(!0,t));t=this._GetStyleTag(t,"size");t=(t?parseFloat(t.param):this._fontSize)*this._fontSizeScale;
const p=this._measureContext.measureText(q);let r=0;this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements()&&(q=this._measureContextTop.measureText(q),r=p.fontBoundingBoxAscent-q.fontBoundingBoxAscent);return{width:p.width,height:m(t),fontBoundingBoxAscent:p.fontBoundingBoxAscent||0,fontBoundingBoxDescent:p.fontBoundingBoxDescent||0,topToAlphabeticDistance:r}}_SetDrawFontString(q){this._lastTextCanvasFont!==q&&(this._lastTextCanvasFont=q,this._textContext.font=q)}_SetDrawCanvasColor(q){this._lastTextCanvasFillStyle!==
q&&(this._lastTextCanvasFillStyle=q,this._textContext.fillStyle=q,this._textContext.strokeStyle=q)}_SetDrawCanvasOpacity(q){this._lastTextCanvasOpacity!==q&&(this._lastTextCanvasOpacity=q,this._textContext.globalAlpha=q)}_SetDrawCanvasLineWith(q){this._lastTextCanvasLineWidth!==q&&(this._lastTextCanvasLineWidth=q,this._textContext.lineWidth=q)}_DrawTextToCanvas(){this._drawCharCount=0;const q=this._scaleFactor*this._zoom*self.devicePixelRatio,t=(4+this._lineHeight)*q;var p=0;const r=this._wrappedText.GetLines();
if(0!==r.length){var x=this._isBBcodeEnabled&&this._SupportsFontBoundingBoxMeasurements(),y=r[0].height*q;"center"===this._verticalAlign?(p=r.reduce((D,G)=>D+G.height*q+t,0)-t,p=Math.max(this._height/2-p/2,0),x&&(y=r[0].topToAlphabeticDistance*q)):"bottom"===this._verticalAlign&&(p=r.reduce((D,G)=>D+G.height*q+t,0)-this._lineHeight*q,x=x?r.at(-1).fontBoundingBoxDescent*q:0,p=this._height-p-x-2);for(let D=0,G=r.length;D<G;++D){x=r[D];const A=x.height*q,F=p;if(this._isBBcodeEnabled){if(p+=0===D?y:A,
0<D&&p>this._height-4*q)break}else if(0<D&&p>=this._height-A)break;0<=F&&this._DrawTextLine(x,p,q);this._isBBcodeEnabled||(p+=A);p+=t}}}_DrawTextLine(q,t,p){let r=0;"center"===this._horizontalAlign?r=(this._width-q.width*p)/2:"right"===this._horizontalAlign&&(r=this._width-q.width*p);for(const x of q.fragments)this._DrawTextFragment(x,r,t,p,q.height),r+=x.width*p}_DrawTextFragment(q,t,p,r,x){const y=this._textContext,D=x/16;x=q.width*r;const G=q.height*r,A=q.height/16;var F=(4+this._lineHeight)*r,
J=q.styles;q=q.text;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+q.length>this._drawMaxCharCount&&(q=q.substr(0,this._drawMaxCharCount-this._drawCharCount),x=this._MeasureText(q,J).width*r);this._drawCharCount+=q.length}var B=this._GetStyleTag(J,"background");const I=this._HasStyleTag(J,"u"),L=this._HasStyleTag(J,"s");if((!e.IsStringAllWhitespace(q)||B||I||L)&&!this._HasStyleTag(J,"hide")){var Q=this._GetStyleTag(J,"offsetx");t+=Q?parseFloat(Q.param)*
r:0;Q=this._GetStyleTag(J,"offsety");p+=Q?parseFloat(Q.param)*r:0;B&&(this._SetDrawCanvasColor(B.param),y.fillRect(t,p-G,x,G+F));F=this._GetStyleTag(J,"color");this._SetDrawCanvasColor(F?F.param:this._colorStr);B=this._GetStyleTag(J,"opacity");this._SetDrawCanvasOpacity(B?parseFloat(B.param)/100:1);B=(B=this._GetStyleTag(J,"linethickness"))?parseFloat(B.param):1;(Q=this._HasStyleTag(J,"stroke"))&&this._SetDrawCanvasLineWith(.5*A*B*this._scaleFactor*this._zoom*self.devicePixelRatio);this._SetDrawFontString(this._GetFontString(!1,
J));g(y,Q,q,t,p,x);!Q&&(this._SetDrawCanvasLineWith(.5*A*B*this._scaleFactor*this._zoom*self.devicePixelRatio),J=this._GetStyleTag(J,"outline"))&&(this._SetDrawCanvasColor(J.param),g(y,!0,q,t,p,x));this._SetDrawCanvasColor(F?F.param:this._colorStr);I&&l(y,Q,t,p+r*D,x,r*D*B);L&&(r*=A,y.fillRect(t,p-G/4+r/2-r*B/2,x,r*B))}}_UpdateTexture(){if(!this._renderer.IsContextLost()&&(this._textureWidth=Math.ceil(this._width),this._textureHeight=Math.ceil(this._height),this._rcTex.set(0,0,this._width/this._textureWidth,
this._height/this._textureHeight),this._needToRecreateTexture&&(this.ReleaseTexture(),this._needToRecreateTexture=!1),this._texture||(this._texture=this._renderer.CreateDynamicTexture(this._textureWidth,this._textureHeight,{mipMap:1===this._zoom,mipMapQuality:"high"})),this._renderer.UpdateTexture(this._textCanvas,this._texture),this.ontextureupdate))this.ontextureupdate()}GetTexRect(){return this._rcTex}ReleaseTexture(){this._texture&&(this._renderer.IsContextLost()||this._renderer.DeleteTexture(this._texture),
this._texture=null)}static OnContextLost(){for(const q of h)q.ReleaseTexture()}static GetAll(){return h.values()}}}
{"use strict";const e=self.C3;class b{constructor(a){this._gl=a.GetContext();this._version=a.GetWebGLVersionNumber();this._timerExt=a._GetDisjointTimerQueryExtension();this._query=null;this._hasResult=this._isActive=!1;this._result=0;this._query=1===this._version?this._timerExt.createQueryEXT():this._gl.createQuery()}Release(){this._DeleteQueryObject();this._timerExt=this._gl=null;this._hasResult=!1}_DeleteQueryObject(){this._query&&(1===this._version?this._timerExt.deleteQueryEXT(this._query):this._gl.deleteQuery(this._query),
this._query=null)}BeginTimeElapsed(){if(this._isActive)throw Error("query already active");1===this._version?this._timerExt.beginQueryEXT(this._timerExt.TIME_ELAPSED_EXT,this._query):this._gl.beginQuery(this._timerExt.TIME_ELAPSED_EXT,this._query);this._isActive=!0}EndTimeElapsed(){if(!this._isActive)throw Error("query not active");1===this._version?this._timerExt.endQueryEXT(this._timerExt.TIME_ELAPSED_EXT):this._gl.endQuery(this._timerExt.TIME_ELAPSED_EXT);this._isActive=!1}CheckForResult(){if(this._query&&
!this._hasResult&&!this._isActive){var a=1===this._version?this._timerExt.getQueryObjectEXT(this._query,this._timerExt.QUERY_RESULT_AVAILABLE_EXT):this._gl.getQueryParameter(this._query,this._gl.QUERY_RESULT_AVAILABLE);var d=this._gl.getParameter(this._timerExt.GPU_DISJOINT_EXT);a&&!d&&(this._result=1===this._version?this._timerExt.getQueryObjectEXT(this._query,this._timerExt.QUERY_RESULT_EXT):this._gl.getQueryParameter(this._query,this._gl.QUERY_RESULT),this._result/=1E9,this._hasResult=!0);(a||
d)&&this._DeleteQueryObject()}}HasResult(){return this._hasResult}GetResult(){if(!this._hasResult)throw Error("no result available");return this._result}}e.Gfx.WebGLTimeElapsedQuery=class{constructor(a){this._renderer=a;this._frameNumber=a.GetFrameNumber();this._isActive=!1;this._parentQuery=null;this._isNested=!1;this._realQuery=null;this._queries=[]}Release(){for(const a of this._queries)a instanceof b&&a.Release();e.clearArray(this._queries);this._renderer=this._realQuery=this._parentQuery=null}BeginTimeElapsed(){if(this._isActive)throw Error("query already active");
const a=this._renderer._GetTimeQueryStack();0<a.length?(this._isNested=!0,this._parentQuery=a.at(-1),this._parentQuery._EndReal(),this._parentQuery._queries.push(this)):(this._isNested=!1,this._parentQuery=null);this._isActive=!0;a.push(this);this._StartReal()}EndTimeElapsed(){if(!this._isActive)throw Error("query not active");if(this._renderer._GetTimeQueryStack().pop()!==this)throw Error("can only end most nested query");this._isActive=!1;this._EndReal();this._parentQuery&&(this._parentQuery._StartReal(),
this._parentQuery=null)}_StartReal(){this._realQuery=e.New(b,this._renderer);this._queries.push(this._realQuery);this._realQuery.BeginTimeElapsed()}_EndReal(){this._realQuery.EndTimeElapsed();this._realQuery=null}CheckForResult(){for(const a of this._queries)a.CheckForResult()}IsNested(){return this._isNested}HasResult(){return this._queries.every(a=>a.HasResult())}GetResult(){return this._queries.reduce((a,d)=>a+d.GetResult(),0)}GetFrameNumber(){return this._frameNumber}}}
{"use strict";const e=self.C3;e.Gfx.WebGLQueryResultBuffer=class{constructor(b,a=1E3){this._renderer=b;this._maxQueries=a;this._buffer=[];this._renderer._AddQueryResultBuffer(this)}Release(){this.Clear();this._renderer._RemoveQueryResultBuffer(this);this._renderer=null}Clear(){for(const b of this._buffer)b.Release();e.clearArray(this._buffer)}AddTimeElapsedQuery(){const b=new e.Gfx.WebGLTimeElapsedQuery(this._renderer);this._buffer.push(b);this._buffer.length>this._maxQueries&&this._buffer.shift().Release();
return b}CheckForResults(b){for(const a of this._buffer){if(a.GetFrameNumber()>=b)break;if(a.IsNested())break;a.CheckForResult()}}GetFrameRangeResultSum(b,a){if(a<=b)return NaN;let d=0;for(const c of this._buffer){if(c.GetFrameNumber()>=a)break;if(!(c.GetFrameNumber()<b))if(c.HasResult())d+=c.GetResult();else return NaN}return d}DeleteAllBeforeFrameNumber(b){for(let a=0,d=this._buffer.length;a<d;++a){const c=this._buffer[a];if(c.GetFrameNumber()<b)c.Release();else{0<a&&this._buffer.splice(0,a);break}}}}}
{"use strict";const e=self.C3,b=self.glMatrix,a=b.vec4,d=b.mat4,c={powerPreference:"default",enableGpuProfiling:!0,alpha:!1,lowLatency:!1,depth:!1,canSampleDepth:!1,maxWebGLVersion:2,failIfMajorPerformanceCaveat:!1},f=new Set(["default","low-power","high-performance"]),h=new e.Quad(0,0,1,0,1,1,0,1),g=d.create(),l=d.create(),m=new e.Quad,u=new e.Rect;let w=null;e.isDebug&&(self.debug_lose_context=function(){w?w.loseContext():console.warn("WEBGL_lose_context not supported")},self.debug_restore_context=
function(){w?w.restoreContext():console.warn("WEBGL_lose_context not supported")});const q=new Set;let t=-1;function p(){t=-1;for(const r of q)r.checkFunc()&&(r.resolve(),q.delete(r));0<q.size&&(t=self.requestAnimationFrame(p))}e.Gfx.WebGLRenderer=class extends e.Gfx.RendererBase{constructor(r,x){super();x=Object.assign({},c,x);if(!f.has(x.powerPreference))throw Error("invalid power preference");const y={alpha:!!x.alpha,depth:!1,antialias:!1,powerPreference:x.powerPreference,failIfMajorPerformanceCaveat:!!x.failIfMajorPerformanceCaveat};
x.lowLatency&&(y.desynchronized=!0,y.preserveDrawingBuffer=!0);let D=null,G=0;2<=x.maxWebGLVersion&&(D=r.getContext("webgl2",y),G=2);D||(D=r.getContext("webgl",y),G=1);if(!D)throw Error("failed to initialise WebGL context");this._gl=D;this._attribs=D.getContextAttributes();x.lowLatency&&!this._attribs.desynchronized&&console.info("[WebGLRenderer] Low-latency mode specified but is not supported here");this._versionString=D.getParameter(D.VERSION);this._version=G;this._viewport=a.create();this._didChangeTransform=
!1;this._bbProjectionMatrix=d.create();this._usesDepthBuffer=!!x.depth;this._canSampleDepth=!(!x.depth||!x.canSampleDepth);this._isDepthEnabled=this._usesDepthBuffer;this._isDepthSamplingEnabled=!1;this._depthBuffer=null;this._isAutoSizeDepthBuffer=!0;this._depthBufferHeight=this._depthBufferWidth=0;this._pointBuffer=this._indexBuffer=this._texcoordBuffer=this._vertexBuffer=null;this._vertexData=new Float32Array(8E3*this.GetNumVertexComponents());this._indexData=new Uint16Array(12E3);this._texcoordData=
new Float32Array(16E3);this._pointData=new Float32Array(32E3);this._lastVertexPtr=this._pointPtr=this._texPtr=this._vertexPtr=0;this._spDeviceTransformTextureFill=this._lastProgram=null;this._batch=[];this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=null;this._lastPointZ=0;this._batchState=e.New(e.Gfx.BatchState,this);this._lastColor=e.New(e.Color,1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._lastDestBlend=this._lastSrcBlend=0;this._lastPointTexCoords=new e.Rect;this._lastScissorRect=
e.New(e.Rect,0,0,-1,-1);this._maxTextureSize=-1;this._highpPrecision=this._maxPointSize=this._minPointSize=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._extensions=[];this._isInitialisingAfterContextRestored=!1;this._fragDepthExt=this._depthTextureExt=this._anisotropicExt=this._parallelShaderCompileExt=null;this._maxAnisotropy=0;this._isGpuProfilingEnabled=!!x.enableGpuProfiling;this._timerExt=null;this._allQueryResultBuffers=new Set;this._timeQueryStack=[];this.FillIndexBufferData(this._indexData)}IsWebGL(){return!0}async InitState(){super.InitState();
var r=this._gl,x=this.GetNumVertexComponents();this._lastColor.setRgba(1,1,1,1);this._lastTexture1=this._lastTexture0=null;this._pointPtr=this._vertexPtr=0;this._lastVertexPtr=8E3*x-4*x;e.clearArray(this._batch);this._topOfBatch=this._batchPtr=0;this._currentRenderTarget=this._lastProgram=null;this._lastPointTexCoords.set(0,0,1,1);this._lastPointZ=0;x=this._batchState;x.currentShader=null;x.currentFramebuffer=null;x.currentFramebufferNoDepth=null;a.set(x.currentColor,1,1,1,1);x.clearColor.setRgba(0,
0,0,0);x.pointTexCoords.set(0,0,1,1);r.clearColor(0,0,0,0);r.clear(r.COLOR_BUFFER_BIT);r.enable(r.BLEND);r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA);this._lastSrcBlend=r.ONE;this._lastDestBlend=r.ONE_MINUS_SRC_ALPHA;this._InitBlendModes(r);r.disable(r.CULL_FACE);r.disable(r.STENCIL_TEST);r.disable(r.DITHER);this._usesDepthBuffer?(r.enable(r.DEPTH_TEST),r.depthMask(!0),r.depthFunc(r.LEQUAL)):(r.disable(r.DEPTH_TEST),r.depthMask(!1));this._isDepthEnabled=this._usesDepthBuffer;this._isDepthSamplingEnabled=
!1;this._pointBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._pointBuffer);r.bufferData(r.ARRAY_BUFFER,this._pointData.byteLength,r.DYNAMIC_DRAW);this._vertexBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._vertexBuffer);r.bufferData(r.ARRAY_BUFFER,this._vertexData.byteLength,r.DYNAMIC_DRAW);this._texcoordBuffer=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,this._texcoordBuffer);r.bufferData(r.ARRAY_BUFFER,this._texcoordData.byteLength,r.DYNAMIC_DRAW);this._indexBuffer=r.createBuffer();
r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this._indexBuffer);r.bufferData(r.ELEMENT_ARRAY_BUFFER,this._indexData,r.STATIC_DRAW);r.activeTexture(r.TEXTURE0);r.bindTexture(r.TEXTURE_2D,null);this._maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE);x=r.getParameter(r.ALIASED_POINT_SIZE_RANGE);this._minPointSize=x[0];this._maxPointSize=x[1];x=r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT);var y=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);this._highpPrecision=x&&y?Math.min(x.precision,
y.precision):0;2048<this._maxPointSize&&(this._maxPointSize=2048);this._extensions=r.getSupportedExtensions();if(x=r.getExtension("WEBGL_debug_renderer_info"))this._unmaskedVendor=r.getParameter(x.UNMASKED_VENDOR_WEBGL),this._unmaskedRenderer=r.getParameter(x.UNMASKED_RENDERER_WEBGL);this._parallelShaderCompileExt=r.getExtension("KHR_parallel_shader_compile");e.isDebug&&(w=r.getExtension("WEBGL_lose_context"));if(this._isGpuProfilingEnabled)if(1===this.GetWebGLVersionNumber()){if("Chromium"!==e.Platform.BrowserEngine||
81<=e.Platform.BrowserVersionNumber||"undefined"!==typeof document)this._timerExt=r.getExtension("EXT_disjoint_timer_query")}else this._timerExt=r.getExtension("EXT_disjoint_timer_query_webgl2")||r.getExtension("EXT_disjoint_timer_query");this._maxAnisotropy=(this._anisotropicExt=r.getExtension("EXT_texture_filter_anisotropic"))?r.getParameter(this._anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0;if(2>this.GetWebGLVersionNumber()&&this._usesDepthBuffer&&this._canSampleDepth&&(this._depthTextureExt=
r.getExtension("WEBGL_depth_texture"),!this._depthTextureExt))throw Error("no depth texture support");2>this.GetWebGLVersionNumber()&&(this._fragDepthExt=r.getExtension("EXT_frag_depth"));r=e.Gfx.WebGLShaderProgram;x=r.GetDefaultVertexShaderSource(!1);y=r.GetTextureFillFragmentShaderSource_WebGL1_NoFragDepth();r=[[y,x,"<default>"],[y,x,"<default-device-transform>"],[r.GetPointFragmentShaderSource(this._version),r.GetPointVertexShaderSource(this._version),"<point>"],[r.GetColorFillFragmentShaderSource(),
x,"<fill>"],[r.GetLinearGradientFillFragmentShaderSource(),x,"<lineargradient>"],[r.GetHardEllipseFillFragmentShaderSource(),x,"<hardellipse>"],[r.GetHardEllipseOutlineFragmentShaderSource(),x,"<hardellipseoutline>"],[r.GetSmoothEllipseFillFragmentShaderSource(),x,"<smoothellipse>"],[r.GetSmoothEllipseOutlineFragmentShaderSource(),x,"<smoothellipseoutline>"],[r.GetSmoothLineFillFragmentShaderSource(),x,"<smoothline>"],[r.GetTilemapFragmentShaderSource(),r.GetDefaultVertexShaderSource(!0),"<tilemap>"]];
r=await Promise.all(r.map(D=>this.CreateShaderProgram({src:D[0]},D[1],D[2])));this._spTextureFill=r[0];this._spDeviceTransformTextureFill=r[1];this._spPoints=r[2];this._spColorFill=r[3];this._spLinearGradientFill=r[4];this._spHardEllipseFill=r[5];this._spHardEllipseOutline=r[6];this._spSmoothEllipseFill=r[7];this._spSmoothEllipseOutline=r[8];this._spSmoothLineFill=r[9];this._spTilemapFill=r[10];this.SetTextureFillMode()}async CreateShaderProgram(r,x,y){r=await e.Gfx.WebGLShaderProgram.Create(this,
r,x,y);this._AddShaderProgram(r);return r}ResetLastProgram(){this._lastProgram=null}SetSize(r,x,y){if(this._width!==r||this._height!==x||y){this.EndBatch();y=this._gl;var D=this._batchState;this._width=r;this._height=x;this._SetViewport(0,0,r,x);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,r/x);this.SetProjectionMatrix(this._bbProjectionMatrix);this._spDeviceTransformTextureFill&&(y.useProgram(this._spDeviceTransformTextureFill.GetShaderProgram()),this._spDeviceTransformTextureFill._UpdateDeviceTransformUniforms(this._matP),
this._lastProgram=this._spDeviceTransformTextureFill,this._batchState.currentShader=this._spDeviceTransformTextureFill);y.bindTexture(y.TEXTURE_2D,null);y.activeTexture(y.TEXTURE1);y.bindTexture(y.TEXTURE_2D,null);y.activeTexture(y.TEXTURE0);this._lastTexture1=this._lastTexture0=null;this._usesDepthBuffer&&this._isAutoSizeDepthBuffer&&this._SetDepthBufferSize(this._width,this._height);this._currentRenderTarget&&this._currentRenderTarget._Resize(this._width,this._height);y.bindFramebuffer(y.FRAMEBUFFER,
null);this._currentRenderTarget=null;D.currentFramebuffer=null;D.currentFramebufferNoDepth=null}}_SetDepthBufferSize(r,x){const y=this._gl;this._depthBuffer&&this._depthBufferWidth===r&&this._depthBufferHeight===x||(this._canSampleDepth?(this._depthBuffer&&y.deleteTexture(this._depthBuffer),this._depthBuffer=y.createTexture(),y.bindTexture(y.TEXTURE_2D,this._depthBuffer),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.NEAREST),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.NEAREST),y.texParameteri(y.TEXTURE_2D,
y.TEXTURE_WRAP_S,y.CLAMP_TO_EDGE),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.CLAMP_TO_EDGE),2<=this.GetWebGLVersionNumber()?y.texImage2D(y.TEXTURE_2D,0,y.DEPTH24_STENCIL8,r,x,0,y.DEPTH_STENCIL,y.UNSIGNED_INT_24_8,null):this._depthTextureExt&&y.texImage2D(y.TEXTURE_2D,0,y.DEPTH_STENCIL,r,x,0,y.DEPTH_STENCIL,this._depthTextureExt.UNSIGNED_INT_24_8_WEBGL,null),y.bindTexture(y.TEXTURE_2D,null)):(this._depthBuffer&&y.deleteRenderbuffer(this._depthBuffer),this._depthBuffer=y.createRenderbuffer(),y.bindRenderbuffer(y.RENDERBUFFER,
this._depthBuffer),y.renderbufferStorage(y.RENDERBUFFER,2<=this._version?y.DEPTH24_STENCIL8:y.DEPTH_STENCIL,r,x),y.bindRenderbuffer(y.RENDERBUFFER,null)),this._depthBufferWidth=r,this._depthBufferHeight=x)}SetFixedSizeDepthBuffer(r,x){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!1,this._SetDepthBufferSize(r,x))}SetAutoSizeDepthBuffer(){this._usesDepthBuffer&&(this._isAutoSizeDepthBuffer=!0,this._SetDepthBufferSize(this._width,this._height))}_SetViewport(r,x,y,D){const G=this._viewport;if(G[0]!==
r||G[1]!==x||G[2]!==y||G[3]!==D)this.PushBatch().InitSetViewport(r,x,y,D),a.set(G,r,x,y,D),this._topOfBatch=0}SetFovY(r){super.SetFovY(r);this.CalculatePerspectiveMatrix(this._bbProjectionMatrix,this._width/this._height)}SetProjectionMatrix(r){d.exactEquals(this._matP,r)||(this.PushBatch().InitSetProjection(r),d.copy(this._matP,r),this._topOfBatch=0,this._didChangeTransform=!0)}SetDefaultRenderTargetProjectionState(){let r,x;var y=this._currentRenderTarget;null===y?(r=this._bbProjectionMatrix,x=this.GetWidth(),
y=this.GetHeight()):(r=y.GetProjectionMatrix(),x=y.GetWidth(),y=y.GetHeight());this.SetProjectionMatrix(r);this._SetViewport(0,0,x,y)}SetModelViewMatrix(r){d.exactEquals(this._matMV,r)||(this.PushBatch().InitSetModelView(r),d.copy(this._matMV,r),this._topOfBatch=0,this._didChangeTransform=!0)}ResetDidChangeTransformFlag(){this._didChangeTransform=!1}DidChangeTransform(){return this._didChangeTransform}GetBatchState(){return this._batchState}PushBatch(){const r=this._batch;this._batchPtr===r.length&&
r.push(new e.Gfx.WebGLBatchJob(this._batchState));return r[this._batchPtr++]}EndBatch(){0===this._batchPtr||this.IsContextLost()||(this._WriteBuffers(),this._ExecuteBatch(),this._topOfBatch=this._pointPtr=this._texPtr=this._vertexPtr=this._batchPtr=0)}_WriteBuffers(){const r=this._gl;0<this._pointPtr&&(r.bindBuffer(r.ARRAY_BUFFER,this._pointBuffer),r.bufferSubData(r.ARRAY_BUFFER,0,this._pointData.subarray(0,this._pointPtr)));0<this._vertexPtr&&(r.bindBuffer(r.ARRAY_BUFFER,this._vertexBuffer),r.bufferSubData(r.ARRAY_BUFFER,
0,this._vertexData.subarray(0,this._vertexPtr)),r.bindBuffer(r.ARRAY_BUFFER,this._texcoordBuffer),r.bufferSubData(r.ARRAY_BUFFER,0,this._texcoordData.subarray(0,this._texPtr)))}_ExecuteBatch(){const r=this._batch;for(let x=0,y=this._batchPtr;x<y;++x)r[x].Run()}GetOpacity(){return this._lastColor.getA()}SetColorRgba(r,x,y,D){const G=this._lastColor;G.equalsRgba(r,x,y,D)||(G.setRgba(r,x,y,D),this.PushBatch().InitSetColor(G),this._topOfBatch=0,this._currentStateGroup=null)}SetOpacity(r){const x=this._lastColor;
x.getA()!==r&&(x.setA(r),this.PushBatch().InitSetColor(x),this._topOfBatch=0,this._currentStateGroup=null)}SetColor(r){const x=this._lastColor;x.equals(r)||(x.set(r),this.PushBatch().InitSetColor(x),this._topOfBatch=0,this._currentStateGroup=null)}ResetColor(){this.SetColorRgba(1,1,1,1)}GetColor(){return this._lastColor}SetTexture(r){r!==this._lastTexture0&&(this.PushBatch().InitSetTexture(r),this._lastTexture0=r,this._topOfBatch=0)}_ResetLastTexture(){this._lastTexture0=null}SetBlendMode(r){r=this._GetBlendByIndex(r);
this._SetBlend(r[0],r[1])}SetNamedBlendMode(r){r=this.GetNamedBlend(r);this._SetBlend(r.srcBlend,r.destBlend)}_SetBlend(r,x){if(r!==this._lastSrcBlend||x!==this._lastDestBlend)this.PushBatch().InitSetBlend(r,x),this._lastSrcBlend=r,this._lastDestBlend=x,this._topOfBatch=0,this._currentStateGroup=null}IsPremultipliedAlphaBlend(){return this._lastSrcBlend===this._gl.ONE&&this._lastDestBlend===this._gl.ONE_MINUS_SRC_ALPHA}SetAlphaBlend(){this._SetBlend(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA)}SetNoPremultiplyAlphaBlend(){this._SetBlend(this._gl.SRC_ALPHA,
this._gl.ONE_MINUS_SRC_ALPHA)}SetCopyBlend(){this._SetBlend(this._gl.ONE,this._gl.ZERO)}Rect(r){this.Rect2(r.getLeft(),r.getTop(),r.getRight(),r.getBottom())}Rect2(r,x,y,D){this.Quad2(r,x,y,x,y,D,r,D)}_ExtendQuadBatch(){let r=this._vertexPtr;r>=this._lastVertexPtr&&(this.EndBatch(),r=0);1===this._topOfBatch?this._batch[this._batchPtr-1]._indexCount+=6:(this.PushBatch().InitQuad(r,6),this._topOfBatch=1)}_WriteQuadToVertexBuffer(r){r.writeToTypedArray3D(this._vertexData,this._vertexPtr,this._baseZ+
this._currentZ);this._vertexPtr+=12}Quad(r){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);h.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad2(r,x,y,D,G,A,F,J){this._ExtendQuadBatch();const B=this._vertexData;let I=this._vertexPtr;const L=this._baseZ+this._currentZ;B[I++]=r;B[I++]=x;B[I++]=L;B[I++]=y;B[I++]=D;B[I++]=L;B[I++]=G;B[I++]=A;B[I++]=L;B[I++]=F;B[I++]=J;B[I++]=L;this._vertexPtr=I;h.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3(r,
x){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);x.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad4(r,x){this._ExtendQuadBatch();this._WriteQuadToVertexBuffer(r);x.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D(r,x,y,D,G,A,F,J,B,I,L,Q,S){this._ExtendQuadBatch();const U=this._vertexData;let V=this._vertexPtr;const Z=this._baseZ+this._currentZ;U[V++]=r;U[V++]=x;U[V++]=Z+y;U[V++]=D;U[V++]=G;U[V++]=Z+A;U[V++]=F;U[V++]=J;U[V++]=Z+B;U[V++]=
I;U[V++]=L;U[V++]=Z+Q;this._vertexPtr=V;S.writeAsQuadToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}Quad3D2(r,x,y,D,G,A,F,J,B,I,L,Q,S){this._ExtendQuadBatch();const U=this._vertexData;let V=this._vertexPtr;const Z=this._baseZ+this._currentZ;U[V++]=r;U[V++]=x;U[V++]=Z+y;U[V++]=D;U[V++]=G;U[V++]=Z+A;U[V++]=F;U[V++]=J;U[V++]=Z+B;U[V++]=I;U[V++]=L;U[V++]=Z+Q;this._vertexPtr=V;S.writeToTypedArray(this._texcoordData,this._texPtr);this._texPtr+=8}FullscreenQuad(r,x){d.copy(g,this._matP);d.copy(l,
this._matMV);this.SetDefaultRenderTargetProjectionState();const [y,D]=this.GetRenderTargetSize(this._currentRenderTarget);var G=this.CalculateLookAtModelView2(0,0,this.GetDefaultCameraZ(D),0,0,0,D);this.SetModelViewMatrix(G);if("crop"===r&&this._currentRenderTarget&&x){r=this._width/2;G=this._height/2;const J=x.GetWidth();x=x.GetHeight();var A=this._currentRenderTarget.GetWidth(),F=this._currentRenderTarget.GetHeight();A=Math.min(A,J);const B=Math.min(F,x),I=Math.max(x-F,0);F=Math.max(F-x,0);u.set(-r,
G-F,-r+A,G-B-F);m.setFromRect(u);u.set(0,I,A,B+I);u.divide(J,x);this.Quad3(m,u)}else r=y/2,G=D/2,this.Rect2(-r,G,r,-G);this.SetProjectionMatrix(g);this.SetModelViewMatrix(l)}StartRenderingPoints(r){this._lastPointTexCoords.equals(r)||(this._lastPointTexCoords.copy(r),this.PushBatch().InitSetPointTexCoords(r),this._topOfBatch=0)}FinishRenderingPoints(){}Point(r,x,y,D){7996<=this._pointPtr&&this.EndBatch();let G=this._pointPtr;var A=this._baseZ+this._currentZ;2===this._topOfBatch&&this._lastPointZ===
A?this._batch[this._batchPtr-1]._indexCount++:(this.PushBatch().InitPoints(G,A),this._topOfBatch=2,this._lastPointZ=A);A=this._pointData;A[G++]=r;A[G++]=x;A[G++]=y;A[G++]=D;this._pointPtr=G}SetProgram(r){this._lastProgram!==r&&(this.PushBatch().InitSetProgram(r),this._lastProgram=r,this._topOfBatch=0,this._currentStateGroup=null)}SetDeviceTransformTextureFillMode(){this.SetProgram(this._spDeviceTransformTextureFill)}SetGradientColor(r){this.PushBatch().InitSetGradientColor(r);this._topOfBatch=0}SetEllipseParams(r,
x,y=1){this.PushBatch().InitSetEllipseParams(r,x,y);this._topOfBatch=0}SetTilemapInfo(r,x,y,D,G,A,F){if(this._lastProgram!==this._spTilemapFill)throw Error("must set tilemap fill mode first");this.PushBatch().InitSetTilemapInfo(r,x,y,D,G,A,F);this._topOfBatch=0}SetProgramParameters(r,x,y,D,G,A,F,J,B,I,L,Q){const S=this._lastProgram;var U=S._hasAnyOptionalUniforms;const V=!!Q.length;if(U&&!S.AreOptionalUniformsAlreadySetInBatch(x,y,D,G,A,F,J,B,I,L)||V&&!S.AreCustomParametersAlreadySetInBatch(Q)){var Z=
this.PushBatch();Z.InitSetProgramParameters();U&&(S.SetOptionalUniformsInBatch(x,y,D,G,A,F,J,B,I,L),U=Z._mat4param,U[0]=A,U[1]=F,x.writeToTypedArray(U,2),U[6]=B,U[7]=I,y.writeToTypedArray(U,12),x=Z._colorParam,G.writeToTypedArray(x,0),G=x[1],x[1]=x[3],x[3]=G,D.writeToTypedArray(Z._srcOriginRect,0),Z._startIndex=L,Z._indexCount=J,S._uSamplerBack.IsUsed()?Z._texParam=r?r.GetTexture():null:Z._texParam=null);V&&(S.SetCustomParametersInBatch(Q),e.shallowAssignArray(Z._shaderParams,Q));this._topOfBatch=
0}}ClearRgba(r,x,y,D){this.PushBatch().InitClearSurface2(r,x,y,D);this._topOfBatch=0}Clear(r){this.PushBatch().InitClearSurface(r);this._topOfBatch=0}Start(){}Finish(){super.Finish();this._gl.flush()}ClearDepth(){this._usesDepthBuffer&&this._currentRenderTarget&&this._currentRenderTarget.HasDepthBuffer()&&(this.PushBatch().InitClearDepth(this._isDepthEnabled),this._topOfBatch=0)}SetDepthEnabled(r){r=!!r;this._isDepthEnabled!==r&&this._usesDepthBuffer&&(this._isDepthEnabled=r,this.PushBatch().InitSetDepthEnabled(r),
this._topOfBatch=0)}IsDepthEnabled(){return this._isDepthEnabled}_GetDepthBuffer(){return this._depthBuffer}_CanSampleDepth(){return this._canSampleDepth}SetDepthSamplingEnabled(r){r=!!r;if(this._canSampleDepth&&this._isDepthSamplingEnabled!==r){if(r&&this.IsDepthEnabled())throw Error("depth still enabled");this._isDepthSamplingEnabled=r;this.PushBatch().InitSetDepthSamplingEnabled(r);this._topOfBatch=0}}SetScissorRect(r,x,y,D,G=0){r=Math.floor(r);x=Math.floor(x);y=Math.floor(y);D=Math.floor(D);this._lastScissorRect.equalsWH(r,
x,y,D)||(this._lastScissorRect.setWH(r,x,y,D),x=(G||this.GetRenderTargetSize(this.GetRenderTarget())[1])-x-D,this.PushBatch().InitSetScissor(!0,r,x,y,D),this._topOfBatch=0)}RemoveScissorRect(){-1!==this._lastScissorRect.getRight()&&(this._lastScissorRect.set(0,0,-1,-1),this.PushBatch().InitSetScissor(!1,0,0,0,0),this._topOfBatch=0)}CheckForQueryResults(){for(const r of this._allQueryResultBuffers)r.CheckForResults(this._frameNumber)}IsContextLost(){return!this._gl||this._gl.isContextLost()||this._isInitialisingAfterContextRestored}OnContextLost(){super.OnDeviceOrContextLost();
e.Gfx.WebGLRendererTexture.OnContextLost();e.Gfx.WebGLRenderTarget.OnContextLost();e.Gfx.RendererText.OnContextLost();for(const r of this._allQueryResultBuffers)r.Clear();this._extensions=[];this._fragDepthExt=this._depthTextureExt=this._anisotropicExt=this._parallelShaderCompileExt=this._timerExt=null;this._maxAnisotropy=0;this._unmaskedRenderer=this._unmaskedVendor="(unavailable)";this._depthBuffer=this._spDeviceTransformTextureFill=this._lastProgram=null;for(const r of this._stateGroups.values())r.OnContextLost()}async OnContextRestored(){this._isInitialisingAfterContextRestored=
!0;await this.InitState();this._isInitialisingAfterContextRestored=!1;for(const r of this._stateGroups.values())r.OnContextRestored(this);this.SetSize(this._width,this._height,!0)}CreateStaticTexture(r,x){if(this.IsContextLost())throw Error("context lost");this.EndBatch();const y=e.New(e.Gfx.WebGLRendererTexture,this);y._CreateStatic(r,x);return y}async CreateStaticTextureAsync(r,x){if(this.IsContextLost())throw Error("context lost");x=Object.assign({},x);if(e.Supports.ImageBitmapOptions){let y=await createImageBitmap(r,
{premultiplyAlpha:"premultiply"});const D=x.wrapX&&"clamp-to-edge"!==x.wrapX||x.wrapY&&"clamp-to-edge"!==x.wrapY,G=e.isPOT(y.width)&&e.isPOT(y.height);this.SupportsNPOTTextures()||G||!D?x.premultiplyAlpha=!1:e.Supports.ImageBitmapOptionsResize?(y=await createImageBitmap(r,{premultiplyAlpha:"premultiply",resizeWidth:e.nextHighestPowerOfTwo(y.width),resizeHeight:e.nextHighestPowerOfTwo(y.height)}),x.premultiplyAlpha=!1):y=await createImageBitmap(r,{premultiplyAlpha:"none"});return await e.Asyncify(()=>
this.CreateStaticTexture(y,x))}if(r instanceof Blob){if("undefined"===typeof Image)throw Error("texture upload variant not supported in worker");r=await e.BlobToImage(r)}return await e.Asyncify(()=>this.CreateStaticTexture(r,x))}CreateDynamicTexture(r,x,y){this.EndBatch();const D=e.New(e.Gfx.WebGLRendererTexture,this);D._CreateDynamic(r,x,y);return D}UpdateTexture(r,x,y){this.EndBatch();x._Update(r,y)}DeleteTexture(r){r&&(r.SubtractReference(),0<r.GetReferenceCount()||(this.EndBatch(),r===this._lastTexture0&&
(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null),r===this._lastTexture1&&(this._gl.activeTexture(this._gl.TEXTURE1),this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._gl.activeTexture(this._gl.TEXTURE0),this._lastTexture1=null),r._Delete()))}CreateRenderTarget(r){let x=this._width,y=this._height,D=!0;r&&("number"===typeof r.width&&(x=r.width,D=!1),"number"===typeof r.height&&(y=r.height,D=!1));if(0>=x||0>=y)throw Error("invalid size");this.EndBatch();const G=e.New(e.Gfx.WebGLRenderTarget,
this);G._Create(x,y,Object.assign({isDefaultSize:D},r));this._currentRenderTarget=null;this._batchState.currentFramebuffer=null;this._batchState.currentFramebufferNoDepth=null;return G}SetRenderTarget(r,x=!0){r!==this._currentRenderTarget&&(r&&r.IsDefaultSize()&&r._Resize(this._width,this._height),this.PushBatch().InitSetRenderTarget(r),this._currentRenderTarget=r,this._topOfBatch=0,x&&this.SetDefaultRenderTargetProjectionState())}GetRenderTarget(){return this._currentRenderTarget}GetRenderTargetSize(r){return r?
[r.GetWidth(),r.GetHeight()]:[this._width,this._height]}CopyRenderTarget(r,x="stretch"){2>this._version||this._currentRenderTarget&&0<this._currentRenderTarget.GetMultisampling()?(this.SetCopyBlend(),this.ResetColor(),this.DrawRenderTarget(r,x)):(this.PushBatch().InitBlitFramebuffer(r,this._currentRenderTarget,x),this._topOfBatch=0)}DrawRenderTarget(r,x="stretch"){r=r.GetTexture();if(!r)throw Error("not a texture-backed render target");this.SetTexture(r);this.FullscreenQuad(x,r)}InvalidateRenderTarget(r){2>
this._version||(this.PushBatch().InitInvalidateFramebuffer(r._GetFramebuffer()),this._topOfBatch=0)}DeleteRenderTarget(r){this.SetRenderTarget(null);this.EndBatch();const x=r.GetTexture();x===this._lastTexture0&&(this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._lastTexture0=null);x===this._lastTexture1&&(this._gl.activeTexture(this._gl.TEXTURE1),this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._gl.activeTexture(this._gl.TEXTURE0),this._lastTexture1=null);r._Delete()}async ReadBackRenderTargetToImageData(r,
x,y){this.EndBatch();const D=this._currentRenderTarget;if(r){var G=r.GetWidth();var A=r.GetHeight();var F=r._GetFramebuffer()}else G=this.GetWidth(),A=this.GetHeight(),F=null;let J=r=0;var B=G,I=A;y&&(r=e.clamp(Math.floor(y.getLeft()),0,G-1),J=e.clamp(Math.floor(y.getTop()),0,A-1),B=y.width(),B=0===B?G-r:e.clamp(Math.floor(B),0,G-r),I=y.height(),I=0===I?A-J:e.clamp(Math.floor(I),0,A-J),J=A-(J+I));const L=this._gl;L.bindFramebuffer(L.FRAMEBUFFER,F);A=()=>{L.bindFramebuffer(L.FRAMEBUFFER,null);this._currentRenderTarget=
null;this._batchState.currentFramebuffer=null;this._batchState.currentFramebufferNoDepth=null;this.SetRenderTarget(D)};if(!x&&2<=this.GetWebGLVersionNumber()){L.bindFramebuffer(L.READ_FRAMEBUFFER,F);F=L.createBuffer();y=B*I*4;G=L.PIXEL_PACK_BUFFER;L.bindBuffer(G,F);L.bufferData(G,y,L.STREAM_READ);L.readPixels(r,J,B,I,L.RGBA,L.UNSIGNED_BYTE,0);L.bindFramebuffer(L.READ_FRAMEBUFFER,null);L.bindBuffer(G,null);A();const Q=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);await this._WaitForObjectReady(()=>L.getSyncParameter(Q,
L.SYNC_STATUS)===L.SIGNALED);L.deleteSync(Q);x=new ImageData(B,I);L.bindBuffer(G,F);L.getBufferSubData(G,0,new Uint8Array(x.data.buffer),0,y);L.bindBuffer(G,null);L.deleteBuffer(F)}else x=new ImageData(B,I),L.readPixels(r,J,B,I,L.RGBA,L.UNSIGNED_BYTE,new Uint8Array(x.data.buffer)),A();return x}CoplanarStartStencilPass(){this.SetDepthEnabled(!0);this.PushBatch().InitCoplanarStartStencilPass();this._topOfBatch=0}CoplanarStartColorPass(){this.SetDepthEnabled(!1);this.PushBatch().InitCoplanarStartColorPass();
this._topOfBatch=0}CoplanarRestoreStandardRendering(){this.SetDepthEnabled(!0);this.PushBatch().InitCoplanarRestore();this._topOfBatch=0}StartQuery(r){this.SupportsGPUProfiling()&&(this.PushBatch().InitStartQuery(r),this._topOfBatch=0)}EndQuery(r){this.SupportsGPUProfiling()&&(this.PushBatch().InitEndQuery(r),this._topOfBatch=0)}_WaitForObjectReady(r){const x=new Promise(y=>q.add({resolve:y,checkFunc:r}));-1===t&&(t=self.requestAnimationFrame(p));return x}IsDesynchronized(){return!!this._attribs.desynchronized}GetEstimatedBackBufferMemoryUsage(){return this._width*
this._height*(this._attribs.alpha?4:3)}GetEstimatedRenderBufferMemoryUsage(){let r=0;for(const x of e.Gfx.WebGLRenderTarget.allRenderTargets())x.GetTexture()||(r+=x.GetEstimatedMemoryUsage());return r}GetEstimatedTextureMemoryUsage(){let r=0;for(const x of e.Gfx.WebGLRendererTexture.allTextures())r+=x.GetEstimatedMemoryUsage();return r}GetEstimatedTotalMemoryUsage(){return this.GetEstimatedBackBufferMemoryUsage()+this.GetEstimatedRenderBufferMemoryUsage()+this.GetEstimatedTextureMemoryUsage()}GetWebGLVersionString(){return this._versionString}GetWebGLVersionNumber(){return this._version}GetDisplayName(){return"webgl"+
this.GetWebGLVersionNumber()}SupportsNPOTTextures(){return 2<=this.GetWebGLVersionNumber()}GetMaxTextureSize(){return this._maxTextureSize}GetMinPointSize(){return this._minPointSize}GetMaxPointSize(){return this._maxPointSize}SupportsHighP(){return 0!==this._highpPrecision}GetHighPPrecision(){return this._highpPrecision}GetUnmaskedVendor(){return this._unmaskedVendor}GetUnmaskedRenderer(){return this._unmaskedRenderer}GetExtensions(){return this._extensions}SupportsGPUProfiling(){return!!this._timerExt}_GetDisjointTimerQueryExtension(){return this._timerExt}_GetParallelShaderCompileExtension(){return this._parallelShaderCompileExt}_GetAnisotropicExtension(){return this._anisotropicExt}_GetMaxAnisotropy(){return this._maxAnisotropy}_AddQueryResultBuffer(r){this._allQueryResultBuffers.add(r)}_RemoveQueryResultBuffer(r){this._allQueryResultBuffers.delete(r)}_GetTimeQueryStack(){return this._timeQueryStack}GetContext(){return this._gl}_InitBlendModes(r){this._InitBlendModeData([["normal",
r.ONE,r.ONE_MINUS_SRC_ALPHA],["additive",r.ONE,r.ONE],["xor",r.ONE,r.ONE_MINUS_SRC_ALPHA],["copy",r.ONE,r.ZERO],["destination-over",r.ONE_MINUS_DST_ALPHA,r.ONE],["source-in",r.DST_ALPHA,r.ZERO],["destination-in",r.ZERO,r.SRC_ALPHA],["source-out",r.ONE_MINUS_DST_ALPHA,r.ZERO],["destination-out",r.ZERO,r.ONE_MINUS_SRC_ALPHA],["source-atop",r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],["destination-atop",r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA]])}CreateRendererText(){return e.New(e.Gfx.RendererText,this)}CreateWebGLText(){return this.CreateRendererText()}}}
{"use strict";const e={getDrawSize:null,getRenderTarget:null,releaseRenderTarget:null,getTime:null,redraw:null};self.C3.Gfx.EffectChainManager=class{constructor(b){b=Object.assign({},e,b);this._cbGetDrawSize=b.getDrawSize;this._cbGetRenderTarget=b.getRenderTarget;this._cbReleaseRenderTarget=b.releaseRenderTarget;this._cbGetTime=b.getTime;this._cbRedraw=b.redraw}GetDrawSize(b){return this._cbGetDrawSize?this._cbGetDrawSize(b):[b.GetWidth(),b.GetHeight()]}GetRenderTarget(b){return this._cbGetRenderTarget(b)}ReleaseRenderTarget(b,
a){this._cbReleaseRenderTarget(b,a)}GetTime(){return this._cbGetTime()}Redraw(b){this._cbRedraw(b)}}}
{"use strict";const e=self.C3,b=self.glMatrix.mat4,a=e.New(e.Rect),d=e.New(e.Rect),c=e.New(e.Rect),f=e.New(e.Rect),h=b.create(),g=b.create(),l={drawContent:null,getSourceTextureInfo:null,getShaderParameters:null,invalidateRenderTargets:!1},m={indexMap:null,forcePreDraw:!1,forcePostDraw:!1,is3D:!1,isSourceTextureRotated:!1,isRotatedOrNegativeSizeInstance:!1,useFullSurface:!1},u={contentObject:null,contextObject:null,blendMode:0,devicePixelRatio:1,layerScale:1,layerAngle:0,layoutRect:null,drawSurfaceRect:null,
drawContentHook:null,compositOffX:0,compositOffY:0,updateOwnProjection:!1};e.Gfx.EffectChain=class{constructor(w,q){q=Object.assign({},l,q);this._manager=w;this._cbDrawContent=q.drawContent;this._cbGetSourceTextureInfo=q.getSourceTextureInfo;this._cbGetShaderParameters=q.getShaderParameters;this._cbDrawContentHook=null;this._shaderProgramList=[];this._shaderProgramIndices=[];this._steps=[];this._blendMode=0;this._isSourceTextureRotated=this._useFullSurface=this._canUseFastPath=this._depthEnabledAtStart=
this._didChangeTransform=this._isAnyShaderDepthSampling=this._isAnyShaderAnimated=!1;this._numTempSurfacesRequired=0;this._renderTargets=[null,null,null];this._invalidateRenderTargets=!!q.invalidateRenderTargets;this._drawHeight=this._drawWidth=this._boxExtendVertical=this._boxExtendHorizontal=0;this._contextObject=this._contentObject=null;this._layoutRect=e.New(e.Rect);this._drawSurfaceRect=e.New(e.Rect);this._rcTexOriginal=e.New(e.Rect);this._rcTexBounce=e.New(e.Rect);this._rcTexDest=e.New(e.Rect);
this._layerScale=this._devicePixelRatio=1;this._time=this._layerAngle=0;this._destRenderTarget=null;this._compositOffY=this._compositOffX=0;this._updateOwnProjection=!1;this._projectionMatrix=b.create();this._modelViewMatrix=b.create()}Release(){e.clearArray(this._steps);e.clearArray(this._shaderProgramList);e.clearArray(this._shaderProgramIndices);this._cbGetShaderParameters=this._cbGetSourceTextureInfo=this._cbDrawContent=this._contextObject=this._contentObject=null}BuildSteps(w,q){q=Object.assign({},
m,q);e.clearArray(this._steps);this._boxExtendVertical=this._boxExtendHorizontal=0;this._isAnyShaderDepthSampling=this._isAnyShaderAnimated=!1;this._numTempSurfacesRequired=0;this._isSourceTextureRotated=!!q.isSourceTextureRotated;this._useFullSurface=!!q.useFullSurface;e.shallowAssignArray(this._shaderProgramList,w);if(0!==w.length){if(q.indexMap){if(q.indexMap.length!==w.length)throw Error("incorrect indexMap length");e.shallowAssignArray(this._shaderProgramIndices,q.indexMap)}else{e.clearArray(this._shaderProgramIndices);
for(let r=0,x=w.length;r<x;++r)this._shaderProgramIndices.push(r)}for(var t of w)this._boxExtendHorizontal+=t.GetBoxExtendHorizontal(),this._boxExtendVertical+=t.GetBoxExtendVertical(),t.IsAnimated()&&(this._isAnyShaderAnimated=!0),t.UsesDepth()&&(this._isAnyShaderDepthSampling=!0);t=w[0];if(1!==w.length||t.BlendsBackground()||t.UsesCrossSampling()||!q.useFullSurface&&t.ExtendsBox()||q.forcePreDraw||t.MustPreDraw()||q.forcePostDraw||q.is3D||!this._useFullSurface&&t.UsesDepth()||t.GetRenderer().IsWebGL()&&
t.UsesAnySrcRectOrPixelSize()&&q.isSourceTextureRotated){this._canUseFastPath=!1;t=this._ShouldPreDraw(t,q);q=this._ShouldPostDraw(w.at(-1),q);var p=0;t&&(this._numTempSurfacesRequired=1,this._steps.push(e.New(e.Gfx.EffectChain.Step.PreDraw,this,-1,1)),p=1);for(let r=0,x=w.length;r<x;++r)0!==r||t?(w=1===p?2:1,r!==x-1||q||(w=0),this._numTempSurfacesRequired=Math.max(this._numTempSurfacesRequired,w),this._steps.push(e.New(e.Gfx.EffectChain.Step.Bounce,this,p,w,r)),p=w):(this._numTempSurfacesRequired=
1,this._steps.push(e.New(e.Gfx.EffectChain.Step.FirstBounce,this,-1,1,r)),p=1);q&&this._steps.push(e.New(e.Gfx.EffectChain.Step.PostDraw,this,p,0))}else this._canUseFastPath=!0}}_ShouldPreDraw(w,q){const t=w.GetRenderer().IsWebGL()&&q.isSourceTextureRotated;return q.forcePreDraw||q.is3D||!this._useFullSurface&&w.UsesDepth()||w.MustPreDraw()||w.BlendsBackground()&&(q.isRotatedOrNegativeSizeInstance||t)||t&&w.UsesAnySrcRectOrPixelSize()||0!==this._boxExtendHorizontal||0!==this._boxExtendVertical}_ShouldPostDraw(w,
q){return q.forcePostDraw||w.BlendsBackground()||w.UsesCrossSampling()}Render(w,q,t){t=Object.assign({},u,t);w.IsWebGPU()&&null===q&&(q=w.GetBackbufferRenderTarget());this._destRenderTarget=q;this._contentObject=t.contentObject;this._contextObject=t.contextObject;this._blendMode=t.blendMode;this._devicePixelRatio=t.devicePixelRatio;this._layerScale=t.layerScale;this._layerAngle=t.layerAngle;this._time=this._manager.GetTime();this._didChangeTransform=!1;w.ResetDidChangeTransformFlag();this._isAnyShaderAnimated&&
this._Redraw();if(this._canUseFastPath)this._Render_FastPath(w,t);else{var [p,r]=this._manager.GetDrawSize(w);this._SetDrawSize(w,p,r);this._CalculateRectangles(t);w.ResetColor();w.SetBaseZ(0);w.SetCurrentZ(0);this._cbDrawContentHook=t.drawContentHook;this._compositOffX=t.compositOffX||0;this._compositOffY=t.compositOffY||0;this._updateOwnProjection=!!t.updateOwnProjection;this._OnBeforeStartEffectChain(w);this._renderTargets[0]=q;this._renderTargets[1]=1<=this._numTempSurfacesRequired?this._GetRenderTarget():
null;this._renderTargets[2]=2===this._numTempSurfacesRequired?this._GetRenderTarget():null;for(const x of this._steps)q=this._GetRenderTargetForId(x.GetSrcTargetId()),t=this._GetRenderTargetForId(x.GetDestTargetId()),w.IsWebGPU()?x.Run_WebGPU(w,q,t):x.Run_WebGL(w,q,t);this._renderTargets[1]&&this._ReleaseRenderTarget(this._renderTargets[1]);this._renderTargets[2]&&this._ReleaseRenderTarget(this._renderTargets[2]);this._renderTargets.fill(null);this._OnAfterEndEffectChain(w);this._cbDrawContentHook=
this._contextObject=this._contentObject=this._destRenderTarget=null}}_SetDrawSize(w,q,t){if(0>=q||0>=t)throw Error("invalid draw size");this._drawWidth===q&&this._drawHeight===t||this._CalculateDeviceTransformMatrices(w,q,t,0,0,this._projectionMatrix,this._modelViewMatrix);this._drawWidth=q;this._drawHeight=t}_CalculateDeviceTransformMatrices(w,q,t,p,r,x,y){p=q/2+p;r=t/2+r;w.CalculatePerspectiveMatrix(x,q/t);w=w.CalculateLookAtModelView2(p,r,w.GetDefaultCameraZ(t),p,r,0,t);b.copy(y,w)}_CalculateRectangles(w){this._layoutRect.copy(w.layoutRect);
w.drawSurfaceRect?this._drawSurfaceRect.copy(w.drawSurfaceRect):this._drawSurfaceRect.set(0,0,this._drawWidth,this._drawHeight);this._rcTexOriginal.copy(this._drawSurfaceRect);this._rcTexOriginal.divide(this._drawWidth,this._drawHeight);w=w.layerScale*w.devicePixelRatio;this._drawSurfaceRect.inflate(this._boxExtendHorizontal*w,this._boxExtendVertical*w);this._rcTexDest.copy(this._drawSurfaceRect);this._rcTexDest.divide(this._drawWidth,this._drawHeight);this._drawSurfaceRect.clamp(0,0,this._drawWidth,
this._drawHeight);this._rcTexBounce.copy(this._drawSurfaceRect);this._rcTexBounce.divide(this._drawWidth,this._drawHeight)}_OnBeforeStartEffectChain(w){this._depthEnabledAtStart=w.IsDepthEnabled();if(this._useFullSurface)w.SetDepthEnabled(!1),this._isAnyShaderDepthSampling&&w.SetDepthSamplingEnabled(!0);else{a.copy(this._drawSurfaceRect);if(w.IsWebGL()){const q=this._layerScale*this._devicePixelRatio;a.inflate(Math.max(this._boxExtendHorizontal,1)*q,Math.max(this._boxExtendVertical,1)*q);a.roundOuter();
a.clamp(0,0,this._drawWidth,this._drawHeight)}else a.roundOuter();w.SetScissorRect(a.getLeft(),a.getTop(),a.width(),a.height(),this._drawHeight)}}_OnAfterEffectChainDrawContent(w){w.ResetColor();this._useFullSurface||(w.SetDepthEnabled(!1),this._isAnyShaderDepthSampling&&w.SetDepthSamplingEnabled(!0));w.IsWebGPU()&&w.SetNormalizedCoordsProgramVariant(!0)}_OnAfterEndEffectChain(w){w.SetDepthSamplingEnabled(!1);w.SetDepthEnabled(this._depthEnabledAtStart);this._useFullSurface||w.RemoveScissorRect();
w.IsWebGPU()&&w.SetNormalizedCoordsProgramVariant(!1);this._didChangeTransform=w.DidChangeTransform()}_ClampRcTexDest(){this._rcTexDest.clamp(0,0,1,1)}_GetRenderTargetForId(w){return 0>w?null:this._renderTargets[w]}_GetRenderTarget(){return this._manager.GetRenderTarget(this)}_GetDestRenderTarget(){return this._destRenderTarget}_ReleaseRenderTarget(w){this._manager.ReleaseRenderTarget(w,this)}_GetShaderProgramAt(w){return this._shaderProgramList[w]}_DrawContent(w){this._cbDrawContentHook?this._cbDrawContentHook(this,
w,()=>this._cbDrawContent(w,this)):this._cbDrawContent(w,this);this._canUseFastPath||this._OnAfterEffectChainDrawContent(w)}_IsRenderTargetSameSizeAndOffset(w){if(this._useFullSurface)return!0;if(0!==this._compositOffX||0!==this._compositOffY)return!1;const [q,t]=w.GetRenderTargetSize(w.GetRenderTarget());return q!==this._drawWidth||t!==this._drawHeight?!1:!0}_SetDeviceTransform(w,q){let t=this._projectionMatrix,p=this._modelViewMatrix;if(q&&!this._IsRenderTargetSameSizeAndOffset(w)){t=h;p=g;const [r,
x]=w.GetRenderTargetSize(w.GetRenderTarget());this._CalculateDeviceTransformMatrices(w,r,x,this._compositOffX,this._compositOffY,t,p);this._useFullSurface||w.RemoveScissorRect()}w.SetProjectionMatrix(t);w.SetModelViewMatrix(p)}_Redraw(){this._manager.Redraw(this)}_GetShaderParameters(w){return this._cbGetShaderParameters(this._shaderProgramIndices[w])}_SetProgramParameters(w,q){let t=this._rcTexDest,p=this._rcTexBounce,r=this._rcTexOriginal;w.IsWebGL()&&(d.copy(t),d.flipAround(1),t=d,c.copy(p),c.flipAround(1),
p=c,f.copy(r),f.flipAround(1),r=f);this._DoSetProgramParameters(w,q,p,r,t,1/this._drawWidth,1/this._drawHeight)}_SetFirstBounceProgramParameters(w,q){let t=this._rcTexBounce,p=this._rcTexOriginal,r=1/this._drawWidth,x=1/this._drawHeight;if(this._cbGetSourceTextureInfo){let {srcTexRect:D,srcWidth:G,srcHeight:A}=this._cbGetSourceTextureInfo(this._contentObject);D||(a.set(0,0,0,0),D=a);G||(G=this._drawWidth);A||(A=this._drawHeight);p=t=D;r=1/G;x=1/A}else w.IsWebGL()&&(c.copy(t),c.flipAround(1),t=c,f.copy(p),
f.flipAround(1),p=f);let y=this._rcTexDest;w.IsWebGL()&&(y=d,y.copy(this._rcTexDest),y.flipAround(1));this._DoSetProgramParameters(w,q,t,p,y,r,x);w.IsWebGPU()&&(this._shaderProgramList[0].BlendsBackground()||this._shaderProgramList[0].UsesAnySrcRectOrPixelSize())&&w.SetProgramParameter_IsSrcTexRotated(this._isSourceTextureRotated)}_DoSetProgramParameters(w,q,t,p,r,x,y){q=this._GetShaderParameters(q);w.SetProgramParameters(this._destRenderTarget,r,t,p,this._layoutRect,x,y,this._devicePixelRatio,this._layerScale,
this._layerAngle,this._time,q)}_Render_FastPath(w,q){var t=this._shaderProgramList[0];const p=w.IsDepthEnabled(),r=t.UsesDepth();r&&(w.SetDepthEnabled(!1),w.SetDepthSamplingEnabled(!0),this._rcTexDest.set(0,0,1,1),this._rcTexOriginal.set(0,0,1,1));w.SetProgram(t);w.SetBlendMode(this._blendMode);w.SetRenderTarget(this._destRenderTarget);let x;this._rcTexOriginal.set(0,0,1,1);if(t.UsesAnySrcRectOrPixelSize()&&this._cbGetSourceTextureInfo){const {srcTexRect:y,srcWidth:D,srcHeight:G}=this._cbGetSourceTextureInfo(this._contentObject);
y&&this._rcTexOriginal.copy(y);t=Number.isFinite(D)?1/D:0;x=Number.isFinite(G)?1/G:0}else{const [y,D]=this._manager.GetDrawSize(w);t=1/y;x=1/D}q.layoutRect?this._layoutRect.copy(q.layoutRect):this._layoutRect.set(0,0,0,0);q=this._GetShaderParameters(0);w.SetProgramParameters(null,this._rcTexDest,this._rcTexOriginal,this._rcTexOriginal,this._layoutRect,t,x,this._devicePixelRatio,this._layerScale,this._layerAngle,this._time,q);w.SetBaseZ(0);this._DrawContent(w);r&&(w.SetDepthSamplingEnabled(!1),w.SetDepthEnabled(p))}IsFastPath(){return this._canUseFastPath}UseFullSurface(){return this._useFullSurface}GetContentObject(){return this._contentObject}GetContextObject(){return this._contextObject}_GetBlendMode(){return this._blendMode}_UpdateOwnProjection(){return this._updateOwnProjection}DidChangeTransform(){return this._didChangeTransform}_GetDrawSurfaceRect(){return this._drawSurfaceRect}_GetRcTexBounce(){return this._rcTexBounce}_ShouldInvalidateRenderTargets(){return this._invalidateRenderTargets}async DebugLogRenderTargetContents(w,
q,t){}}}"use strict";self.C3.Gfx.EffectChain.Step=class{constructor(e,b,a,d=-1){this._effectChain=e;this._srcTargetId=b;this._destTargetId=a;this._index=d}GetEffectChain(){return this._effectChain}GetSrcTargetId(){return this._srcTargetId}GetDestTargetId(){return this._destTargetId}GetIndex(){return this._index}GetShaderProgram(){return this.GetEffectChain()._GetShaderProgramAt(this.GetIndex())}Run_WebGL(e,b,a){}Run_WebGPU(e,b,a){}};
{"use strict";const e=self.C3;e.Gfx.EffectChain.Step.PreDraw=class extends e.Gfx.EffectChain.Step{constructor(b,a,d,c){super(b,a,d,c)}Run_WebGL(b,a,d){a=this.GetEffectChain();b.SetAlphaBlend();b.SetTextureFillMode();b.SetRenderTarget(d,a._UpdateOwnProjection());b.ClearRgba(0,0,0,0);a._DrawContent(b);a._ClampRcTexDest()}Run_WebGPU(b,a,d){a=this.GetEffectChain();b.SetAlphaBlend();b.SetTextureFillMode();b.SetRenderTarget(d,!1);b.ClearRgba(0,0,0,0);a._DrawContent(b);a._ClampRcTexDest()}}}
{"use strict";const e=self.C3,b=e.New(e.Rect),a=e.New(e.Quad);e.Gfx.EffectChain.Step.PostDraw=class extends e.Gfx.EffectChain.Step{constructor(d,c,f,h){super(d,c,f,h)}Run_WebGL(d,c,f){const h=this.GetEffectChain();d.SetTextureFillMode();d.SetRenderTarget(f);h._SetDeviceTransform(d,!0);d.SetBlendMode(h._GetBlendMode());d.SetTexture(c.GetTexture());a.setFromRect(h._GetDrawSurfaceRect());b.copy(h._GetRcTexBounce());b.flipAround(1);d.Quad3(a,b);h._ShouldInvalidateRenderTargets()&&d.InvalidateRenderTarget(c)}Run_WebGPU(d,
c,f){const h=this.GetEffectChain();d.SetTextureFillMode();d.SetRenderTarget(f,!1);h._IsRenderTargetSameSizeAndOffset(d)?a.setFromRect(h._GetRcTexBounce()):(d.SetNormalizedCoordsProgramVariant(!1),h._SetDeviceTransform(d,!0),a.setFromRect(h._GetDrawSurfaceRect()));d.SetBackTexture(null);d.SetBlendMode(h._GetBlendMode());d.SetTexture(c.GetTexture());h.UseFullSurface()?d.FullscreenQuad():d.Quad3(a,h._GetRcTexBounce())}}}
{"use strict";const e=self.C3;e.Gfx.EffectChain.Step.FirstBounce=class extends e.Gfx.EffectChain.Step{constructor(b,a,d,c){super(b,a,d,c)}Run_WebGL(b,a,d){a=this.GetEffectChain();b.SetRenderTarget(d,a._UpdateOwnProjection());b.ClearRgba(0,0,0,0);b.SetCopyBlend();b.SetProgram(this.GetShaderProgram());a._SetFirstBounceProgramParameters(b,this.GetIndex());a._DrawContent(b);a._ClampRcTexDest()}Run_WebGPU(b,a,d){a=this.GetEffectChain();b.SetRenderTarget(d,!1);b.ClearRgba(0,0,0,0);b.SetCopyBlend();b.SetProgram(this.GetShaderProgram());
a._SetFirstBounceProgramParameters(b,this.GetIndex());a._DrawContent(b);a._ClampRcTexDest()}}}
{"use strict";const e=self.C3,b=e.New(e.Rect),a=e.New(e.Quad);e.Gfx.EffectChain.Step.Bounce=class extends e.Gfx.EffectChain.Step{constructor(d,c,f,h){super(d,c,f,h)}Run_WebGL(d,c,f){const h=this.GetEffectChain();d.SetRenderTarget(f);(f=0===this.GetDestTargetId())?d.SetBlendMode(h._GetBlendMode()):(d.ClearRgba(0,0,0,0),d.SetCopyBlend());d.SetProgram(this.GetShaderProgram());h._SetProgramParameters(d,this.GetIndex());d.SetTexture(c.GetTexture());h._SetDeviceTransform(d,f);a.setFromRect(h._GetDrawSurfaceRect());
b.copy(h._GetRcTexBounce());b.flipAround(1);d.Quad3(a,b);h._ShouldInvalidateRenderTargets()&&d.InvalidateRenderTarget(c)}Run_WebGPU(d,c,f){const h=this.GetEffectChain();d.SetRenderTarget(f,!1);0===this.GetDestTargetId()?(d.SetBlendMode(h._GetBlendMode()),d.SetBackTexture(null),h._IsRenderTargetSameSizeAndOffset(d)?a.setFromRect(h._GetRcTexBounce()):(d.SetNormalizedCoordsProgramVariant(!1),h._SetDeviceTransform(d,!0),a.setFromRect(h._GetDrawSurfaceRect()))):(d.ClearRgba(0,0,0,0),d.SetCopyBlend(),a.setFromRect(h._GetRcTexBounce()));
d.SetProgram(this.GetShaderProgram());h._SetProgramParameters(d,this.GetIndex());d.SetTexture(c.GetTexture());h.UseFullSurface()?d.FullscreenQuad():d.Quad3(a,h._GetRcTexBounce())}}}
{"use strict";const e=self.C3,b=self.C3X;let a=null;const d=new Set;function c(l,m){const u=l[0]-m[0];return 0!==u?u:l[1]-m[1]}const f=[],h=[];let g=!1;self.IRuntime=class{constructor(l,m){a=l;Object.defineProperties(this,{assets:{value:a.GetAssetManager().GetIAssetManager(),writable:!1},objects:{value:m,writable:!1},globalVars:{value:{},writable:!1},projectName:{value:a.GetProjectName(),writable:!1},projectVersion:{value:a.GetProjectVersion(),writable:!1},storage:{value:new self.IStorage(a),writable:!1},
isInWorker:{value:a.IsInWorker(),writable:!1}});a.UserScriptDispatcher().addEventListener("keydown",u=>{d.has(u.key)?u.stopPropagation():d.add(u.key)});a.UserScriptDispatcher().addEventListener("keyup",u=>d.delete(u.key));a.Dispatcher().addEventListener("window-blur",()=>d.clear());a.IsInWorker()&&(self.alert=u=>{g||(g=!0,console.warn("[Construct 3] alert() was called from a Web Worker, because the project 'Use worker' setting is enabled. This method is not normally available in a Web Worker. Construct has implemented the alert for you, but note that other features may be missing in worker mode. You may wish to disable 'Use worker', or use a more convenient function like console.log(). For more information please refer to the scripting section of the manual."));
return this.alert(u)})}_InitGlobalVars(l){Object.defineProperties(this.globalVars,l)}addEventListener(l,m){a.UserScriptDispatcher().addEventListener(l,m)}removeEventListener(l,m){a.UserScriptDispatcher().removeEventListener(l,m)}callFunction(l,...m){b.RequireString(l);const u=a.GetEventSheetManager(),w=u.GetFunctionBlockByName(l);if(!w)throw Error(`cannot find function name '${l}'`);if(!w.IsEnabled())return w.GetDefaultReturnValue();if(m.length<w.GetFunctionParameterCount())throw Error(`not enough function parameters passed for '${l}' (${m.length} passed, ${w.GetFunctionParameterCount()} expected)`);
const q=w.GetEventBlock();l=null;var t=u.GetCurrentEvent();t&&(t=t.GetSolModifiersIncludingParents(),0<t.length&&(l=t,u.PushCleanSol(t)));m=q.RunAsExpressionFunctionCall(q.GetSolModifiersIncludingParents(),w.GetReturnType(),w.GetDefaultReturnValue(),...m);l&&u.PopSol(l);return m}setReturnValue(l){const m=a.GetEventStack().GetCurrentExpFuncStackFrame();if(!m)throw Error("not in a function which returns a value");switch(m.GetFunctionReturnType()){case 1:"number"===typeof l&&m.SetFunctionReturnValue(l);
break;case 2:"string"===typeof l&&m.SetFunctionReturnValue(l);break;case 3:"number"!==typeof l&&"string"!==typeof l||m.SetFunctionReturnValue(l)}}get dt(){return a.GetDt()}get gameTime(){return a.GetGameTime()}get wallTime(){return a.GetWallTime()}random(){return a.Random()}get layout(){return a.GetMainRunningLayout().GetILayout()}getLayout(l){const m=a.GetLayoutManager();if("number"===typeof l||"string"===typeof l)l=m.GetLayout(l);else throw new TypeError("expected string or number");if(!l)throw Error("invalid layout");
return l.GetILayout()}getAllLayouts(){return a.GetLayoutManager().GetAllLayouts().map(l=>l.GetILayout())}goToLayout(l){const m=a.GetLayoutManager();if("number"===typeof l||"string"===typeof l)l=m.GetLayout(l);else throw new TypeError("expected string or number");if(!l)throw Error("invalid layout");m.IsPendingChangeMainLayout()||m.ChangeMainLayout(l)}get keyboard(){const l=a._GetCommonScriptInterfaces().keyboard;if(!l)throw Error("runtime.keyboard used but Keyboard object missing - add it to your project first");
return l}get mouse(){const l=a._GetCommonScriptInterfaces().mouse;if(!l)throw Error("runtime.mouse used but Mouse object missing - add it to your project first");return l}get touch(){const l=a._GetCommonScriptInterfaces().touch;if(!l)throw Error("runtime.touch used but Touch object missing - add it to your project first");return l}invokeDownload(l,m){b.RequireString(l);b.RequireString(m);a.InvokeDownload(l,m)}getInstanceByUid(l){b.RequireFiniteNumber(l);return(l=a.GetInstanceByUID(l))?l.GetInterfaceClass():
null}sortZOrder(l,m){b.RequireFunction(m);const u=a.GetCurrentLayout();for(var w of l){l=a._UnwrapIWorldInstance(w);var q=l.GetWorldInfo();f.push([q.GetLayer().GetIndex(),q.GetZIndex()]);h.push(l)}if(0!==f.length){f.sort(c);h.sort((t,p)=>m(t.GetInterfaceClass(),p.GetInterfaceClass()));w=!1;for(let t=0,p=f.length;t<p;++t){l=h[t];q=u.GetLayerByIndex(f[t][0]);const r=f[t][1],x=q._GetInstances();x[r]!==l&&(x[r]=l,l.GetWorldInfo()._SetLayer(q),q.SetZIndicesChanged(),w=!0)}w&&a.UpdateRender();e.clearArray(f);
e.clearArray(h)}}alert(l){return a.PostComponentMessageToDOMAsync("runtime","alert",{message:l+(a.IsInWorker()?" [via Web Worker]":"")})}}}
{"use strict";const e=self.C3;let b=null;self.IAssetManager=class{constructor(a){b=a;Object.defineProperties(this,{isWebMOpusSupported:{value:b.IsAudioFormatSupported("audio/webm; codecs=opus"),writable:!1}})}fetchText(a){return b.FetchText(a)}fetchJson(a){return b.FetchJson(a)}fetchBlob(a){return b.FetchBlob(a)}fetchArrayBuffer(a){return b.FetchArrayBuffer(a)}getProjectFileUrl(a){return b.GetProjectFileUrl(a)}getMediaFileUrl(a){e.IsRelativeURL(a)&&(a=a.toLowerCase());return b.GetMediaFileUrl(a,b.GetMediaSubfolder())}get mediaFolder(){return b.GetMediaSubfolder()}async decodeWebMOpus(a,
d){if(this.isWebMOpusSupported)throw Error("decodeWebMOpus(): not supported because WebM Opus is supported by the platform");d=await b.GetRuntime()._WasmDecodeWebMOpus(d);d=new Float32Array(d);a=a.createBuffer(1,d.length,48E3);a.getChannelData(0).set(d);return a}loadScripts(...a){return b.LoadScripts(...a)}compileWebAssembly(a){return b.CompileWebAssembly(a)}loadStyleSheet(a){return b.LoadStyleSheet(a)}}}
{"use strict";const e=self.C3X;self.IStorage=class{constructor(b){this._storage=b._GetProjectStorage()}getItem(b){e.RequireString(b);return this._storage.getItem(b)}setItem(b,a){e.RequireString(b);return this._storage.setItem(b,a)}removeItem(b){e.RequireString(b);return this._storage.removeItem(b)}clear(){return this._storage.clear()}keys(){return this._storage.keys()}}}
{"use strict";const e=self.C3X,b=new WeakMap;self.IObjectClass=class{constructor(a){b.set(this,a);Object.defineProperties(this,{name:{value:a.GetName(),writable:!1}});a.GetRuntime()._MapScriptInterface(this,a)}addEventListener(a,d){e.RequireString(a);e.RequireFunction(d);b.get(this).UserScriptDispatcher().addEventListener(a,d)}removeEventListener(a,d){e.RequireString(a);e.RequireFunction(d);b.get(this).UserScriptDispatcher().removeEventListener(a,d)}getAllInstances(){return b.get(this).GetInstances().map(a=>
a.GetInterfaceClass())}getFirstInstance(){const a=b.get(this).GetInstances();return 0<a.length?a[0].GetInterfaceClass():null}getPickedInstances(){return b.get(this).GetCurrentSol().GetInstances().map(a=>a.GetInterfaceClass())}getFirstPickedInstance(){const a=b.get(this).GetCurrentSol().GetInstances();return 0<a.length?a[0].GetInterfaceClass():null}*instances(){for(const a of b.get(this).GetInstances())yield a.GetInterfaceClass()}*pickedInstances(){for(const a of b.get(this).GetCurrentSol().GetInstances())yield a.GetInterfaceClass()}setInstanceClass(a){e.RequireFunction(a);
if(0<b.get(this).GetInstanceCount())throw Error("setInstanceClass() called too late, because instances have already been created - call in runOnStartup");b.get(this)._SetUserScriptInstanceClass(a)}createInstance(a,d,c,f){e.RequireNumber(d);e.RequireNumber(c);if("number"!==typeof a&&"string"!==typeof a)throw new TypeError("invalid layer parameter");const h=b.get(this),g=h.GetRuntime();a=g.GetMainRunningLayout().GetLayer(a);if(!a)throw Error("invalid layer");d=g.CreateInstance(h,a,d,c,f);f&&a.SortAndAddInstancesByZIndex(d);
f=g.GetEventSheetManager();f.BlockFlushingInstances(!0);d._TriggerOnCreatedOnSelfAndRelated();f.BlockFlushingInstances(!1);f.IsInEventEngine()||g.FlushPendingInstances();return d.GetInterfaceClass()}}}
{"use strict";const e=self.C3X,b=new WeakMap;self.ILayout=class{constructor(a){b.set(this,a);const d=[],c=a.GetEffectList(),f=c.GetAllEffectTypes().length;for(let h=0;h<f;++h)d.push(new self.IEffectInstance(c,h));Object.defineProperties(this,{name:{value:a.GetName(),writable:!1},index:{value:a.GetIndex(),writable:!1},effects:{value:d,writable:!1}})}addEventListener(a,d){e.RequireString(a);e.RequireFunction(d);b.get(this).UserScriptDispatcher().addEventListener(a,d)}removeEventListener(a,d){e.RequireString(a);
e.RequireFunction(d);b.get(this).UserScriptDispatcher().removeEventListener(a,d)}get width(){return b.get(this).GetWidth()}set width(a){b.get(this).SetWidth(a)}get height(){return b.get(this).GetHeight()}set height(a){b.get(this).SetHeight(a)}set scale(a){e.RequireFiniteNumber(a);b.get(this).SetScale(a)}get scale(){return b.get(this).GetScale()}set angle(a){e.RequireFiniteNumber(a);b.get(this).SetAngle(a)}get angle(){return b.get(this).GetAngle()}set scrollX(a){e.RequireNumber(a);b.get(this).SetScrollX(a)}get scrollX(){return b.get(this).GetScrollX()}set scrollY(a){e.RequireNumber(a);
b.get(this).SetScrollY(a)}get scrollY(){return b.get(this).GetScrollY()}scrollTo(a,d){e.RequireNumber(a);e.RequireNumber(d);const c=b.get(this);c.SetScrollX(a);c.SetScrollY(d)}getLayer(a){const d=b.get(this);if("number"===typeof a||"string"===typeof a)a=d.GetLayer(a);else throw new TypeError("expected string or number");return a?a.GetILayer():null}getAllLayers(){return b.get(this).GetLayers().map(a=>a.GetILayer())}*allLayers(){for(const a of b.get(this).allLayers())yield a.GetILayer()}setVanishingPoint(a,
d){e.RequireFiniteNumber(a);e.RequireFiniteNumber(d);b.get(this).SetVanishingPointXY(a,d)}getVanishingPoint(){return b.get(this)._GetVanishingPoint()}set projection(a){e.RequireString(a);const d=b.get(this);if("perspective"===a)d.SetPerspectiveProjection();else if("orthographic"===a)d.SetOrthographicProjection();else throw Error("invalid projection");}get projection(){return b.get(this).IsOrthographicProjection()?"orthographic":"perspective"}}}
{"use strict";const e=self.C3,b=self.C3X,a=new WeakMap,d=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]),c=new Map([...d.entries()].map(h=>[h[1],h[0]])),f=e.New(e.Color);self.ILayer=class{constructor(h){a.set(this,h);const g=[],l=h.GetEffectList(),m=l.GetAllEffectTypes().length;for(let u=0;u<m;++u)g.push(new self.IEffectInstance(l,u));Object.defineProperties(this,
{name:{value:h.GetName(),writable:!1},index:{value:h.GetIndex(),writable:!1},layout:{value:h.GetLayout().GetILayout(),writable:!1},effects:{value:g,writable:!1}})}static _Unwrap(h){return a.get(h)}get parentLayer(){const h=a.get(this).GetParentLayer();return h?h.GetILayer():null}*parentLayers(){for(const h of a.get(this).parentLayers())yield h.GetILayer()}*subLayers(){for(const h of a.get(this).GetSubLayers())yield h.GetILayer()}*allSubLayers(){for(const h of a.get(this).GetSubLayers())for(const g of h.selfAndAllSubLayers())yield g.GetILayer()}get isVisible(){return a.get(this)._IsVisibleFlagSet()}set isVisible(h){a.get(this).SetVisible(h)}get isSelfAndParentsVisible(){return a.get(this).IsVisible()}get isInteractive(){return a.get(this).IsInteractive()}set isInteractive(h){a.get(this).SetInteractive(h)}get isSelfAndParentsInteractive(){return a.get(this).IsSelfAndParentsInteractive()}get opacity(){return a.get(this).GetOpacity()}set opacity(h){h=
e.clamp(+h,0,1);isNaN(h)||a.get(this).SetOpacity(h)}set scale(h){b.RequireFiniteNumber(h);a.get(this).SetOwnScale(h)}get scale(){return a.get(this).GetOwnScale()}set scaleRate(h){b.RequireFiniteNumber(h);a.get(this).SetScaleRate(h)}get scaleRate(){return a.get(this).GetScaleRate()}set angle(h){b.RequireFiniteNumber(h);a.get(this).SetAngle(h)}get angle(){return a.get(this).GetOwnAngle()}set parallaxX(h){b.RequireFiniteNumber(h);a.get(this).SetParallaxX(h)}get parallaxX(){return a.get(this).GetParallaxX()}set parallaxY(h){b.RequireFiniteNumber(h);
a.get(this).SetParallaxY(h)}get parallaxY(){return a.get(this).GetParallaxY()}set zElevation(h){b.RequireFiniteNumber(h);a.get(this).SetZElevation(h)}get zElevation(){return a.get(this).GetZElevation()}set isTransparent(h){a.get(this).SetTransparent(h)}get isTransparent(){return a.get(this).IsTransparent()}set isForceOwnTexture(h){a.get(this).SetForceOwnTexture(h)}get isForceOwnTexture(){return a.get(this).IsForceOwnTexture()}set blendMode(h){b.RequireString(h);h=d.get(h);if("number"!==typeof h)throw Error("invalid blend mode");
a.get(this).SetBlendMode(h)}get blendMode(){return c.get(a.get(this).GetBlendMode())}set backgroundColor(h){b.RequireArray(h);if(3>h.length)throw Error("expected 3 elements");f.setRgb(h[0],h[1],h[2]);h=a.get(this);const g=h.GetBackgroundColor();g.equalsIgnoringAlpha(f)||(g.copyRgb(f),h.GetRuntime().UpdateRender())}get backgroundColor(){const h=a.get(this).GetBackgroundColor();return[h.getR(),h.getG(),h.getB()]}set scrollX(h){b.RequireNumber(h);const g=a.get(this);g.SetOwnScrollPositionEnabled(!0);
g.SetScrollX(h)}get scrollX(){return a.get(this).GetScrollX()}set scrollY(h){b.RequireNumber(h);const g=a.get(this);g.SetOwnScrollPositionEnabled(!0);g.SetScrollY(h)}get scrollY(){return a.get(this).GetScrollY()}scrollTo(h,g){b.RequireNumber(h);b.RequireNumber(g);const l=a.get(this);l.SetOwnScrollPositionEnabled(!0);l.SetScrollX(h);l.SetScrollY(g)}restoreScrollPosition(){a.get(this).SetOwnScrollPositionEnabled(!1)}getViewport(){return a.get(this).GetViewport().toDOMRect()}cssPxToLayer(h,g,l=0){b.RequireNumber(h);
b.RequireNumber(g);b.RequireNumber(l);const m=a.get(this),u=m.GetRuntime();return m.CanvasCssToLayer(h-u.GetCanvasClientX(),g-u.GetCanvasClientY(),l)}layerToCssPx(h,g,l=0){b.RequireNumber(h);b.RequireNumber(g);b.RequireNumber(l);const m=a.get(this),u=m.GetRuntime(),[w,q]=m.LayerToCanvasCss(h,g,l);return[w+u.GetCanvasClientX(),q+u.GetCanvasClientY()]}}}
{"use strict";const e=self.C3,b=self.C3X,a=new WeakMap,d=new WeakMap;function c(h){let g=d.get(h);if(g)return g;g=e.New(e.Event.Dispatcher);d.set(h,g);return g}let f=null;self.IInstance=class{constructor(){a.set(this,f);const h={runtime:{value:f.GetRuntime().GetIRuntime(),writable:!1},objectType:{value:f.GetObjectClass().GetIObjectClass(),writable:!1},uid:{value:f.GetUID(),writable:!1}};f._GetInstVarsScriptDescriptor(h);f._GetBehaviorsScriptDescriptor(h);Object.defineProperties(this,h);f.GetRuntime()._MapScriptInterface(this,
f)}static _Init(h){f=h}static _GetInitInst(){return f}_Release(){const h=d.get(this);h&&(h.Release(),d.delete(this));a.delete(this)}addEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);c(this).addEventListener(h,g,l)}removeEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);c(this).removeEventListener(h,g,l)}dispatchEvent(h){c(this).dispatchEvent(h)}destroy(){const h=a.get(this),g=h.GetRuntime();g.DestroyInstance(h);g.GetEventSheetManager().IsInEventEngine()||g.FlushPendingInstances()}}}
{"use strict";const e=self.C3,b=self.C3X,a=self.IInstance,d=self.ILayer,c=new WeakMap,f=new Map([["normal",0],["additive",1],["copy",3],["destination-over",4],["source-in",5],["destination-in",6],["source-out",7],["destination-out",8],["source-atop",9],["destination-atop",10]]),h=new Map([...f.entries()].map(l=>[l[1],l[0]])),g=e.New(e.Color);self.IWorldInstance=class l extends a{constructor(){super();var m=a._GetInitInst();c.set(this,m);const u=[];var w=m.GetWorldInfo();if(m=w.GetInstanceEffectList()){w=
w.GetObjectClass().GetEffectList().GetAllEffectTypes().length;for(let q=0;q<w;++q)u.push(new self.IEffectInstance(m,q))}Object.defineProperties(this,{effects:{value:u,writable:!1}})}get layout(){return c.get(this).GetWorldInfo().GetLayout().GetILayout()}get layer(){return c.get(this).GetWorldInfo().GetLayer().GetILayer()}get x(){return c.get(this).GetWorldInfo().GetX()}set x(m){m=+m;const u=c.get(this).GetWorldInfo();isNaN(m)||u.GetX()===m||(u.SetX(m),u.SetBboxChanged())}get y(){return c.get(this).GetWorldInfo().GetY()}set y(m){m=
+m;const u=c.get(this).GetWorldInfo();isNaN(m)||u.GetY()===m||(u.SetY(m),u.SetBboxChanged())}get zElevation(){return c.get(this).GetWorldInfo().GetZElevation()}set zElevation(m){m=+m;const u=c.get(this),w=u.GetWorldInfo();isNaN(m)||w.GetZElevation()===m||(w.SetZElevation(m),u.GetRuntime().UpdateRender())}get totalZElevation(){return c.get(this).GetWorldInfo().GetTotalZElevation()}get width(){return c.get(this).GetWorldInfo().GetWidth()}set width(m){m=+m;const u=c.get(this).GetWorldInfo();isNaN(m)||
u.GetWidth()===m||(u.SetWidth(m),u.SetBboxChanged())}get height(){return c.get(this).GetWorldInfo().GetHeight()}set height(m){m=+m;const u=c.get(this).GetWorldInfo();isNaN(m)||u.GetHeight()===m||(u.SetHeight(m),u.SetBboxChanged())}get angle(){return c.get(this).GetWorldInfo().GetAngle()}set angle(m){m=e.clampAngle(+m);const u=c.get(this).GetWorldInfo();isNaN(m)||u.GetAngle()===m||(u.SetAngle(m),u.SetBboxChanged())}get angleDegrees(){return e.toDegrees(this.angle)}set angleDegrees(m){this.angle=e.toRadians(m)}getBoundingBox(){return c.get(this).GetWorldInfo().GetBoundingBox().toDOMRect()}getBoundingQuad(){return c.get(this).GetWorldInfo().GetBoundingQuad().toDOMQuad()}get isVisible(){return c.get(this).GetWorldInfo().IsVisible()}set isVisible(m){m=
!!m;const u=c.get(this),w=u.GetWorldInfo();w.IsVisible()!==m&&(w.SetVisible(m),u.GetRuntime().UpdateRender())}get opacity(){return c.get(this).GetWorldInfo().GetOpacity()}set opacity(m){m=e.clamp(+m,0,1);const u=c.get(this),w=u.GetWorldInfo();isNaN(m)||w.GetOpacity()===m||(w.SetOpacity(m),u.GetRuntime().UpdateRender())}set colorRgb(m){b.RequireArray(m);if(3>m.length)throw Error("expected 3 elements");g.setRgb(m[0],m[1],m[2]);m=c.get(this);const u=m.GetWorldInfo();u.GetUnpremultipliedColor().equalsIgnoringAlpha(g)||
(u.SetUnpremultipliedColor(g),m.GetRuntime().UpdateRender())}get colorRgb(){const m=c.get(this).GetWorldInfo().GetUnpremultipliedColor();return[m.getR(),m.getG(),m.getB()]}set blendMode(m){b.RequireString(m);m=f.get(m);if("number"!==typeof m)throw Error("invalid blend mode");const u=c.get(this);u.GetWorldInfo().SetBlendMode(m);u.GetRuntime().UpdateRender()}get blendMode(){return h.get(c.get(this).GetWorldInfo().GetBlendMode())}moveToTop(){c.get(this).GetWorldInfo().ZOrderMoveToTop()}moveToBottom(){c.get(this).GetWorldInfo().ZOrderMoveToBottom()}moveToLayer(m){b.RequireInstanceOf(m,
d);m=d._Unwrap(m);if(!m)throw Error("invalid layer");c.get(this).GetWorldInfo().ZOrderMoveToLayer(m)}moveAdjacentToInstance(m,u){b.RequireInstanceOf(m,l);c.get(this).GetWorldInfo().ZOrderMoveAdjacentToInstance(c.get(m),u)}get zIndex(){return c.get(this).GetWorldInfo().GetZIndex()}containsPoint(m,u){b.RequireNumber(m);b.RequireNumber(u);return c.get(this).GetWorldInfo().ContainsPoint(+m,+u)}testOverlap(m){b.RequireInstanceOf(m,l);const u=c.get(this);m=c.get(m);return u.GetRuntime().GetCollisionEngine().TestOverlap(u,
m)}testOverlapSolid(){var m=c.get(this);return(m=m.GetRuntime().GetCollisionEngine().TestOverlapSolid(m))?m.GetInterfaceClass():null}getParent(){const m=c.get(this).GetParent();return m?m.GetInterfaceClass():null}getTopParent(){const m=c.get(this).GetTopParent();return m?m.GetInterfaceClass():null}*parents(){for(const m of c.get(this).parents())yield m.GetInterfaceClass()}getChildCount(){return c.get(this).GetChildCount()}getChildAt(m){return(m=c.get(this).GetChildAt(m))?m.GetInterfaceClass():null}*children(){for(const m of c.get(this).children())yield m.GetInterfaceClass()}*allChildren(){for(const m of c.get(this).allChildren())yield m.GetInterfaceClass()}addChild(m,
u){b.RequireInstanceOf(m,l);b.RequireOptionalObject(u);u||(u={});const w=c.get(this);m=c.get(m);w.AddChild(m,u)}removeChild(m){b.RequireInstanceOf(m,l);const u=c.get(this);m=c.get(m);u.RemoveChild(m)}removeFromParent(){const m=c.get(this);m.HasParent()&&m.GetParent().RemoveChild(m)}createMesh(m,u){b.RequireFiniteNumber(m);b.RequireFiniteNumber(u);c.get(this).GetWorldInfo().CreateMesh(m,u)}releaseMesh(){const m=c.get(this).GetWorldInfo();m.ReleaseMesh();m.SetBboxChanged()}setMeshPoint(m,u,w){b.RequireFiniteNumber(m);
b.RequireFiniteNumber(u);b.RequireObject(w);const q=c.get(this).GetWorldInfo();q.SetMeshPoint(m,u,w)&&q.SetBboxChanged()}getMeshSize(){var m=c.get(this).GetWorldInfo();if(!m.HasMesh())return[0,0];m=m.GetSourceMesh();return[m.GetHSize(),m.GetVSize()]}}}
{"use strict";const e=self.C3X,b=new WeakMap;self.IDOMInstance=class extends self.IWorldInstance{constructor(){super();b.set(this,self.IInstance._GetInitInst())}getElement(){return b.get(this).GetSdkInstance()._GetElementInDOMMode()}focus(){b.get(this).GetSdkInstance().FocusElement()}blur(){b.get(this).GetSdkInstance().BlurElement()}setCssStyle(a,d){e.RequireString(a);b.get(this).GetSdkInstance().SetElementCSSStyle(a,d)}}}
{"use strict";const e=self.C3,b=self.C3X,a=new WeakMap,d=new WeakMap;function c(h){let g=d.get(h);if(g)return g;g=e.New(e.Event.Dispatcher);d.set(h,g);return g}let f=null;self.IBehaviorInstance=class{constructor(){a.set(this,f);const h={runtime:{value:f.GetRuntime().GetIRuntime(),writable:!1},behavior:{value:f.GetBehavior().GetIBehavior(),writable:!1}};Object.defineProperties(this,h)}static _Init(h){f=h}static _GetInitInst(){return f}get instance(){return a.get(this).GetObjectInstance().GetInterfaceClass()}_Release(){const h=
d.get(this);h&&(h.Release(),d.delete(this));a.delete(this)}addEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);c(this).addEventListener(h,g,l)}removeEventListener(h,g,l){b.RequireString(h);b.RequireFunction(g);c(this).removeEventListener(h,g,l)}dispatchEvent(h){c(this).dispatchEvent(h)}}}
{"use strict";const e=new WeakMap;self.IBehavior=class{constructor(b){e.set(this,b);b={runtime:{value:b.GetRuntime().GetIRuntime(),writable:!1}};Object.defineProperties(this,b)}getAllInstances(){return e.get(this).GetInstances().map(b=>b.GetInterfaceClass())}}}
{"use strict";const e=self.C3,b=self.C3X,a=new WeakMap;self.IEffectInstance=class{constructor(d,c){a.set(this,d);Object.defineProperties(this,{index:{value:c,writable:!1}})}get name(){return a.get(this).GetAllEffectTypes()[this.index].GetName()}get isActive(){return a.get(this).IsEffectIndexActive(this.index)}set isActive(d){d=!!d;const c=a.get(this);c.IsEffectIndexActive(this.index)!==d&&(c.SetEffectIndexActive(this.index,d),c.UpdateActiveEffects(),c.GetRuntime().UpdateRender())}setParameter(d,c){b.RequireFiniteNumber(d);
d=Math.floor(+d);const f=a.get(this);var h=f.GetEffectParametersForIndex(this.index);if(0>d||d>=h.length)throw new RangeError("invalid effect parameter index");const g=h[d];if(g instanceof e.Color){if(!Array.isArray(c)||3>c.length)throw new TypeError("expected array with 3 elements");d=c[0];h=c[1];c=c[2];if(g.equalsRgb(d,h,c))return;g.setRgb(d,h,c)}else{if("number"!==typeof c)throw new TypeError("expected number");if(g===c)return;h[d]=c}f.IsEffectIndexActive(this.index)&&f.GetRuntime().UpdateRender()}getParameter(d){b.RequireFiniteNumber(d);
d=Math.floor(+d);const c=a.get(this).GetEffectParametersForIndex(this.index);if(0>d||d>=c.length)throw new RangeError("invalid effect parameter index");d=c[d];return d instanceof e.Color?[d.getR(),d.getG(),d.getB()]:d}}}
{"use strict";const e=new WeakMap;self.IAnimation=class{constructor(b){e.set(this,b);Object.defineProperties(this,{name:{value:b.GetName(),writable:!1},speed:{value:b.GetSpeed(),writable:!1},isLooping:{value:b.IsLooping(),writable:!1},repeatCount:{value:b.GetRepeatCount(),writable:!1},repeatTo:{value:b.GetRepeatTo(),writable:!1},isPingPong:{value:b.IsPingPong(),writable:!1},frameCount:{value:b.GetFrameCount(),writable:!1}})}getFrames(){return e.get(this).GetFrames().map(b=>b.GetIAnimationFrame())}*frames(){for(const b of e.get(this).GetFrames())yield b.GetIAnimationFrame()}}}
{"use strict";const e=new WeakMap;self.IImageInfo=class{constructor(b){e.set(this,b)}get width(){return e.get(this).GetWidth()}get height(){return e.get(this).GetHeight()}}}{"use strict";const e=new WeakMap;self.IAnimationFrame=class extends self.IImageInfo{constructor(b){super(b.GetImageInfo());e.set(this,b);Object.defineProperties(this,{duration:{value:b.GetDuration(),writable:!1},originX:{value:b.GetOriginX(),writable:!1},originY:{value:b.GetOriginY(),writable:!1}})}}}
{"use strict";const e=self.C3,b=new Set(["local","remote"]),a=new Map([["mp4","video/mp4"],["webm","video/webm"],["m4a","audio/mp4"],["mp3","audio/mpeg"],["js","application/javascript"],["wasm","application/wasm"],["svg","image/svg+xml"],["html","text/html"]]);function d(f){if(!f)return"";f=f.split(".");if(2>f.length)return"";f=f.at(-1).toLowerCase();return a.get(f)||""}function c(f){return new Promise((h,g)=>{const l=document.createElement("script");l.onload=h;l.onerror=g;l.async=!1;l.type="module";
l.src=f;document.head.appendChild(l)})}e.AssetManager=class extends e.DefendedBase{constructor(f,h){super();var g=h.exportType;this._runtime=f;this._localUrlBlobs=new Map;this._localBlobUrlCache=new Map;this._localBlobSWUrls=new Map;this._isCordova="cordova"===g;this._isiOSCordova=!!h.isiOSCordova;this._isFileProtocol=!!h.isFileProtocol;this._swClientId=h.swClientId;this._supportedAudioFormats=h.supportedAudioFormats||{};this._audioFiles=new Map;this._preloadSounds=!1;this._iconsSubfolder=this._fontsSubfolder=
this._mediaSubfolder="";this._defaultLoadPolicy="html5"===g||"scirra-arcade"===g||"instant-games"===g?"remote":"local";this._allAssets=[];this._assetsByUrl=new Map;this._webFonts=[];this._loadPromises=[];this._hasFinishedInitialLoad=!1;this._lastLoadProgress=this._assetSizeLoaded=this._totalAssetSizeToLoad=0;this._hasHadErrorLoading=!1;this._loadingRateLimiter=e.New(e.RateLimiter,()=>this._FireLoadingProgressEvent(),50);this._promiseThrottle=new e.PromiseThrottle(Math.max(e.hardwareConcurrency,8));
if(f=h.previewImageBlobs){(g=h.previewProjectFileBlobs)&&Object.assign(f,g);(g=h.projectData)&&(f["data.json"]=g);for(const [l,m]of Object.entries(f))this._localUrlBlobs.set(l.toLowerCase(),m)}if(h=h.previewProjectFileSWUrls)for(const [l,m]of Object.entries(h))this._localBlobSWUrls.set(l,m);this._iAssetManager=new self.IAssetManager(this)}Release(){this._localUrlBlobs.clear();for(const f of this._localBlobUrlCache.values())f.startsWith("blob:")&&URL.revokeObjectURL(f);this._localBlobUrlCache.clear();
for(const f of this._allAssets)f.Release();e.clearArray(this._allAssets);this._assetsByUrl.clear();e.clearArray(this._loadPromises);this._runtime=null}GetRuntime(){return this._runtime}_SetMediaSubfolder(f){this._mediaSubfolder=f}GetMediaSubfolder(){return this._mediaSubfolder}_SetFontsSubfolder(f){this._fontsSubfolder=f}GetFontsSubfolder(){return this._fontsSubfolder}_SetIconsSubfolder(f){this._iconsSubfolder=f}GetIconsSubfolder(){return this._iconsSubfolder}IsFileProtocol(){return this._isFileProtocol}_HasLocalUrlBlob(f){return this._localUrlBlobs.has(f.toLowerCase())}_GetLocalUrlBlob(f){return this._localUrlBlobs.get(f.toLowerCase())||
null}GetLocalUrlAsBlobUrl(f){if(!this._HasLocalUrlBlob(f))return f;f=f.toLowerCase();var h=this._localBlobUrlCache.get(f);h||(h=this._GetLocalUrlBlob(f),h=URL.createObjectURL(h),this._localBlobUrlCache.set(f,h));return h}FetchBlob(f,h){h=h||this._defaultLoadPolicy;const g=this._GetLocalUrlBlob(f);if(g)return Promise.resolve(g);if(e.IsRelativeURL(f)){const l=f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlob(l):"local"===h?this._promiseThrottle.Add(()=>e.FetchBlob(l)):
e.FetchBlob(l)}return e.FetchBlob(f)}FetchArrayBuffer(f){const h=this._GetLocalUrlBlob(f);if(h)return e.BlobToArrayBuffer(h);if(e.IsRelativeURL(f)){const g=f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsArrayBuffer(g):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>e.FetchArrayBuffer(g)):e.FetchArrayBuffer(g)}return e.FetchArrayBuffer(f)}FetchText(f){const h=this._GetLocalUrlBlob(f);if(h)return e.BlobToString(h);if(e.IsRelativeURL(f)){const g=
f.toLowerCase();return this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsText(g):"local"===this._defaultLoadPolicy?this._promiseThrottle.Add(()=>e.FetchText(g)):e.FetchText(g)}return e.FetchText(f)}async FetchJson(f){f=await this.FetchText(f);return JSON.parse(f)}_CordovaFetchLocalFileAs(f,h){return this._runtime.PostComponentMessageToDOMAsync("runtime","cordova-fetch-local-file",{filename:f,as:h})}CordovaFetchLocalFileAsText(f){return this._CordovaFetchLocalFileAs(f,"text")}async CordovaFetchLocalFileAsBlob(f){const h=
await this._CordovaFetchLocalFileAs(f,"buffer");f=d(f);return new Blob([h],{type:f})}async CordovaFetchLocalFileAsBlobURL(f){f=f.toLowerCase();var h=this._localBlobUrlCache.get(f);if(h)return h;h=await this.CordovaFetchLocalFileAsBlob(f);h=URL.createObjectURL(h);this._localBlobUrlCache.set(f,h);return h}CordovaFetchLocalFileAsArrayBuffer(f){return this._CordovaFetchLocalFileAs(f,"buffer")}GetMediaFileUrl(f){return this._HasLocalUrlBlob(f)?this.GetLocalUrlAsBlobUrl(f):this._mediaSubfolder+f.toLowerCase()}GetProjectFileUrl(f,
h=""){if(e.IsAbsoluteURL(f)){if(h)throw Error("cannot specify subfolder with remote URL");return Promise.resolve(f)}return this._HasLocalUrlBlob(f)?Promise.resolve(this.GetLocalUrlAsBlobUrl(f)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(h+f):Promise.resolve(h+f.toLowerCase())}GetProjectFileIframeUrl(f){if(e.IsAbsoluteURL(f))return Promise.resolve(f);var h=f.indexOf("?"),g=-1===h?"":f.substr(h);h=-1===h?f:f.substr(0,h);return this._HasLocalUrlBlob(h)?(f=this._localBlobSWUrls.get(h)||
this.GetLocalUrlAsBlobUrl(h),!f.startsWith("blob:")&&this._swClientId&&(f=new URL(f),g=new URLSearchParams(g),g.set("__c3_client_id",this._swClientId),f.search=g.toString(),f=f.toString()),Promise.resolve(f)):this._isCordova&&this._isFileProtocol?this.CordovaFetchLocalFileAsBlobURL(h):Promise.resolve(f.toLowerCase())}LoadProjectFileUrl(f){return this.GetProjectFileUrl(f)}LoadImage(f){if(f.loadPolicy&&!b.has(f.loadPolicy))throw Error("invalid load policy");let h=this._assetsByUrl.get(f.url);if(h)return h;
h=e.New(e.ImageAsset,this,{url:f.url,size:f.size||0,loadPolicy:f.loadPolicy||this._defaultLoadPolicy});this._allAssets.push(h);this._assetsByUrl.set(h.GetURL(),h);this._hasFinishedInitialLoad||(this._totalAssetSizeToLoad+=h.GetSize(),this._loadPromises.push(h.Load().then(()=>this._AddLoadedSize(h.GetSize()))));return h}async WaitForAllToLoad(){try{await Promise.all(this._loadPromises),this._lastLoadProgress=1}catch(f){console.error("Error loading: ",f),this._hasHadErrorLoading=!0,this._FireLoadingProgressEvent()}}SetInitialLoadFinished(){this._hasFinishedInitialLoad=
!0}HasHadErrorLoading(){return this._hasHadErrorLoading}_AddLoadedSize(f){this._assetSizeLoaded+=f;this._loadingRateLimiter.Call()}_FireLoadingProgressEvent(){const f=e.New(e.Event,"loadingprogress");this._lastLoadProgress=e.clamp(this._assetSizeLoaded/this._totalAssetSizeToLoad,0,1);f.progress=this._lastLoadProgress;this._runtime.Dispatcher().dispatchEvent(f)}GetLoadProgress(){return this._lastLoadProgress}_SetWebFonts(f){e.shallowAssignArray(this._webFonts,f);this._webFonts.length&&this._loadPromises.push(this._LoadWebFonts())}_LoadWebFonts(){if("undefined"===
typeof FontFace)return Promise.resolve();const f=[];for(const [h,g,l]of this._webFonts)this._totalAssetSizeToLoad+=l,f.push(this._LoadWebFont(h,g).then(()=>this._AddLoadedSize(l)));return Promise.all(f)}async _LoadWebFont(f,h){try{const g=await this.GetProjectFileUrl(h,this._fontsSubfolder),l=new FontFace(f,`url('${g}')`);this._runtime.IsInWorker()?self.fonts.add(l):document.fonts.add(l);await l.load()}catch(g){console.warn(`[C3 runtime] Failed to load web font '${f}': `,g)}}IsAudioFormatSupported(f){return!!this._supportedAudioFormats[f]}_SetAudioFiles(f,
h){this._preloadSounds=!!h;for(const [g,l,m]of f)this._audioFiles.set(g,{fileName:g,formats:l.map(u=>({type:u[0],fileExtension:u[1],fullName:g+u[1],fileSize:u[2]})),isMusic:m})}GetPreferredAudioFile(f){f=this._audioFiles.get(f.toLowerCase());if(!f)return null;let h=null;for(const g of f.formats)if(h||"audio/webm; codecs=opus"!==g.type||(h=g),this.IsAudioFormatSupported(g.type))return g;return h}GetProjectAudioFileUrl(f){return(f=this.GetPreferredAudioFile(f))?{url:this.GetMediaFileUrl(f.fullName),
type:f.type}:null}GetAudioToPreload(){if(this._preloadSounds){const f=[];for(const h of this._audioFiles.values()){if(h.isMusic)continue;const g=this.GetPreferredAudioFile(h.fileName);g&&f.push({originalUrl:h.fileName,url:this.GetMediaFileUrl(g.fullName),type:g.type,fileSize:g.fileSize})}return f}return[]}GetIAssetManager(){return this._iAssetManager}async LoadScripts(...f){const h=await Promise.all(f.map(g=>this.GetProjectFileUrl(g)));this._runtime.IsInWorker()?1===f.length?(f=f[0],await self.c3_import((e.IsRelativeURL(f)?
"./":"")+f)):(f=f.map(g=>`import "${e.IsRelativeURL(g)?"./":""}${g}";`).join("\n"),f=URL.createObjectURL(new Blob([f],{type:"application/javascript"})),await self.c3_import(f)):await Promise.all(h.map(g=>c(g)))}async CompileWebAssembly(f){if(WebAssembly.compileStreaming)return f=await this.GetProjectFileUrl(f),await WebAssembly.compileStreaming(fetch(f));f=await e.FetchArrayBuffer(f);return await WebAssembly.compile(f)}async LoadStyleSheet(f){f=await this.GetProjectFileUrl(f);return await this._runtime.PostComponentMessageToDOMAsync("runtime",
"add-stylesheet",{url:f})}}}
{"use strict";const e=self.C3;e.Asset=class extends e.DefendedBase{constructor(b,a){super();this._assetManager=b;this._runtime=b.GetRuntime();this._url=a.url;this._size=a.size;this._loadPolicy=a.loadPolicy;this._blob=null;this._isLoaded=!1;this._loadPromise=null}Release(){this._blob=this._runtime=this._assetManager=this._loadPromise=null}GetURL(){return this._url}GetSize(){return this._size}Load(){return"local"===this._loadPolicy||this._blob?(this._isLoaded=!0,Promise.resolve()):this._loadPromise?
this._loadPromise:this._loadPromise=this._assetManager.FetchBlob(this._url,this._loadPolicy).then(b=>{this._isLoaded=!0;this._loadPromise=null;return this._blob=b}).catch(b=>console.error("Error loading resource: ",b))}IsLoaded(){return this._isLoaded}GetBlob(){return this._blob?Promise.resolve(this._blob):this._loadPromise?this._loadPromise:this._assetManager.FetchBlob(this._url,this._loadPolicy)}}}
{"use strict";const e=self.C3,b=new e.PromiseThrottle,a=new Set;e.ImageAsset=class extends e.Asset{constructor(d,c){super(d,c);this._webglTexture=this._texturePromise=null;this._refCount=0;this._imageHeight=this._imageWidth=-1;a.add(this)}Release(){this.ReleaseTexture();if(0!==this._refCount)throw Error("released image asset which still has texture references");this._texturePromise=null;a.delete(this);super.Release()}static OnWebGLContextLost(){for(const d of a)d._texturePromise=null,d._webglTexture=
null,d._refCount=0}LoadStaticTexture(d,c){c=c||{};this._refCount++;if(this._webglTexture)return Promise.resolve(this._webglTexture);if(this._texturePromise)return this._texturePromise;c.anisotropy=this._runtime.GetCanvasManager().GetTextureAnisotropy();return this._texturePromise=this.GetBlob().then(f=>b.Add(()=>d.CreateStaticTextureAsync(f,c).then(h=>{this._texturePromise=null;if(0===this._refCount)return d.DeleteTexture(h),null;this._webglTexture=h;this._imageWidth=h.GetWidth();this._imageHeight=
h.GetHeight();return this._webglTexture}))).catch(f=>{console.error("Failed to load texture: ",f);throw f;})}ReleaseTexture(){if(0>=this._refCount)throw Error("texture released too many times");this._refCount--;0===this._refCount&&this._webglTexture&&(this._webglTexture.GetRenderer().DeleteTexture(this._webglTexture),this._webglTexture=null)}GetTexture(){return this._webglTexture}GetWidth(){return this._imageWidth}GetHeight(){return this._imageHeight}async LoadToDrawable(){const d=await this.GetBlob();
return e.Supports.ImageBitmapOptions?await createImageBitmap(d,{premultiplyAlpha:"none"}):e.Supports.ImageBitmap?await createImageBitmap(d):await e.BlobToImage(d)}}}
{"use strict";const e=self.C3;function b(a,d){return a.GetWorldInfo()._GetLastCachedZIndex()-d.GetWorldInfo()._GetLastCachedZIndex()}e.RenderCell=class extends e.DefendedBase{constructor(a,d,c){super();this._grid=a;this._x=d;this._y=c;this._instances=[];this._isSorted=!0;this._pendingRemoval=new Set;this._isAnyPendingRemoval=!1}Release(){e.clearArray(this._instances);this._pendingRemoval.clear();this._grid=null}Reset(){e.clearArray(this._instances);this._isSorted=!0;this._pendingRemoval.clear();this._isAnyPendingRemoval=
!1}SetChanged(){this._isSorted=!1}IsEmpty(){if(!this._instances.length)return!0;if(this._instances.length>this._pendingRemoval.size)return!1;this._FlushPending();return!0}Insert(a){this._pendingRemoval.has(a)?(this._pendingRemoval.delete(a),0===this._pendingRemoval.size&&(this._isAnyPendingRemoval=!1)):(this._instances.push(a),this._isSorted=1===this._instances.length)}Remove(a){this._pendingRemoval.add(a);this._isAnyPendingRemoval=!0;50<=this._pendingRemoval.size&&this._FlushPending()}_FlushPending(){this._isAnyPendingRemoval&&
(this._instances.length===this._pendingRemoval.size?this.Reset():(e.arrayRemoveAllInSet(this._instances,this._pendingRemoval),this._pendingRemoval.clear(),this._isAnyPendingRemoval=!1))}_EnsureSorted(){this._isSorted||(this._instances.sort(b),this._isSorted=!0)}Dump(a){this._FlushPending();this._EnsureSorted();this._instances.length&&a.push(this._instances)}}}
{"use strict";const e=self.C3;e.RenderGrid=class extends e.DefendedBase{constructor(b,a){super();this._cellWidth=b;this._cellHeight=a;this._cells=e.New(e.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(b,a,d){let c=this._cells.Get(b,a);return c?c:d?(c=e.New(e.RenderCell,this,b,a),this._cells.Set(b,a,c),c):null}XToCell(b){return Math.floor(b/this._cellWidth)}YToCell(b){return Math.floor(b/this._cellHeight)}Update(b,a,d){if(a)for(let c=a.getLeft(),f=a.getRight();c<=f;++c)for(let h=
a.getTop(),g=a.getBottom();h<=g;++h){if(d&&d.containsPoint(c,h))continue;const l=this.GetCell(c,h,!1);l&&(l.Remove(b),l.IsEmpty()&&this._cells.Delete(c,h))}if(d)for(let c=d.getLeft(),f=d.getRight();c<=f;++c)for(let h=d.getTop(),g=d.getBottom();h<=g;++h)a&&a.containsPoint(c,h)||this.GetCell(c,h,!0).Insert(b)}QueryRange(b,a){let d=this.XToCell(b.getLeft());const c=this.YToCell(b.getTop()),f=this.XToCell(b.getRight());for(b=this.YToCell(b.getBottom());d<=f;++d)for(let h=c;h<=b;++h){const g=this.GetCell(d,
h,!1);g&&g.Dump(a)}}MarkRangeChanged(b){let a=b.getLeft();const d=b.getTop(),c=b.getRight();for(b=b.getBottom();a<=c;++a)for(let f=d;f<=b;++f){const h=this.GetCell(a,f,!1);h&&h.SetChanged()}}}}
{"use strict";const e=self.C3,b=new e.Rect,a=new e.Quad,d=[];new e.Rect;new e.Rect;const c=self.glMatrix,f=c.vec3,h=c.vec4,g=c.mat4,l=g.create(),m=f.create(),u=h.create(),w=f.create(),q=f.create(),t=f.create(),p=e.New(e.Vector2);e.New(e.Rect);function r(A,F){return A.GetWorldInfo()._GetLastCachedZIndex()-F.GetWorldInfo()._GetLastCachedZIndex()}function x(A,F){return A.GetWorldInfo().GetZElevation()-F.GetWorldInfo().GetZElevation()}const y=[],D=[],G=[];e.Layer=class extends e.DefendedBase{constructor(A,
F,J){super();this._layout=A;this._runtime=A.GetRuntime();this._parentLayer=F;this._name=J[0];this._index=-1;this._sid=J[2];this._isVisible=!!J[3];this._isInteractive=!!J[13];this._backgroundColor=e.New(e.Color);this._backgroundColor.setFromJSON(J[4].map(I=>I/255));this._isTransparent=!!J[5];this._parallaxX=J[6];this._parallaxY=J[7];this._color=e.New(e.Color,1,1,1,J[8]);this._premultipliedColor=e.New(e.Color);this._isForceOwnTexture=J[9];this._renderAs3d=J[17];this._useCameraDistanceDrawOrder=J[18];
this._useRenderCells=J[10];this._scaleRate=J[11];this._blendMode=J[12];this._curRenderTarget=null;this._scale=1;this._zElevation=J[16];this._scrollY=this._scrollX=this._angle=0;this._hasOwnScrollPosition=!1;this._viewport=e.New(e.Rect);this._viewportZ0=e.New(e.Rect);this._viewport3D=e.New(e.Rect);this._projectionMatrix=g.create();this._isProjectionMatrixChanged=!0;this._modelViewMatrix=g.create();this._isMVMatrixChanged=!0;this._viewFrustum=e.New(e.Gfx.ViewFrustum);this._isViewFrustumChanged=!0;this._startupInitialInstances=
[];this._initialInstancesData=J[14];this._initialInstances=[];this._createdGlobalUids=[];this._initialUIDsToInstanceData=new Map;this._instances=[];this._anyInstanceZElevated=this._zIndicesUpToDate=!1;const B=this._runtime.GetCanvasManager();this._effectList=e.New(e.EffectList,this,J[15]);this._effectChain=e.New(e.Gfx.EffectChain,B.GetEffectChainManager(),{drawContent:(I,L)=>{L=L.GetContentObject();const Q=L.GetRenderTarget();I.SetColor(L.GetPremultipliedColor());I.DrawRenderTarget(Q);I.InvalidateRenderTarget(Q);
B.ReleaseAdditionalRenderTarget(Q)},getShaderParameters:I=>this.GetEffectList().GetEffectParametersForIndex(I)});this._wasDefaultColor=this._needsRebuildEffectChainSteps=!0;this._renderGrid=null;this._lastRenderList=[];this._isRenderListUpToDate=!1;this._lastRenderCells=e.New(e.Rect,0,0,-1,-1);this._curRenderCells=e.New(e.Rect,0,0,-1,-1);this._iLayer=null;this._UpdatePremultipliedColor();this.UsesRenderCells()&&(this._renderGrid=e.New(e.RenderGrid,this._runtime.GetOriginalViewportWidth(),this._runtime.GetOriginalViewportHeight()));
this._subLayers=J[19].map(I=>e.New(e.Layer,this._layout,this,I))}_Init(){for(const A of this._initialInstancesData){const F=this._runtime.GetObjectClassByIndex(A[1]);this._layout._AddInitialObjectClass(F);F.GetDefaultInstanceData()||(F.SetDefaultInstanceData(A),F._SetDefaultLayerIndex(this._index));this._initialInstances.push(A);this._initialUIDsToInstanceData.set(A[2],A)}e.shallowAssignArray(this._startupInitialInstances,this._initialInstances);this._initialInstancesData=null;this._iLayer=new self.ILayer(this)}Release(){this._runtime=
this._layout=null}GetInitialInstanceData(A){return this._initialUIDsToInstanceData.get(A)}CreateInitialInstances(A){const F=this._layout.IsFirstVisit();let J=0;const B=this._initialInstances;for(let L=0,Q=B.length;L<Q;++L){var I=B[L];const S=this._runtime.GetObjectClassByIndex(I[1]);let U=!0;if(!S.HasPersistBehavior()||F)I=this._runtime.CreateInstanceFromData(I,this,!0),A.push(I),S.IsGlobal()&&(U=!1,this._createdGlobalUids.push(I.GetUID()));U&&(B[J]=B[L],++J)}e.truncateArray(B,J);this._runtime.FlushPendingInstances();
this.SetZIndicesChanged()}_AddInstance(A,F){const J=A.GetWorldInfo();if(J.GetLayer()!==this)throw Error("instance added to wrong layer");this._instances.push(A);0!==J.GetZElevation()&&(this._anyInstanceZElevated=!0);F&&this.UsesRenderCells()&&A.GetWorldInfo().SetBboxChanged();this.SetZIndicesChanged()}_MaybeAddInstance(A){this._instances.includes(A)||(this._instances.push(A),0!==A.GetWorldInfo().GetZElevation()&&(this._anyInstanceZElevated=!0),this.SetZIndicesChanged())}_PrependInstance(A,F){const J=
A.GetWorldInfo();if(J.GetLayer()!==this)throw Error("instance added to wrong layer");this._instances.unshift(A);0!==J.GetZElevation()&&(this._anyInstanceZElevated=!0);this.SetZIndicesChanged();F&&this.UsesRenderCells()&&A.GetWorldInfo().SetBboxChanged()}_RemoveInstance(A,F){const J=this._instances.indexOf(A);0>J||(F&&this.UsesRenderCells()&&A.GetWorldInfo()._RemoveFromRenderCells(),this._instances.splice(J,1),this.SetZIndicesChanged(),this._MaybeResetAnyInstanceZElevatedFlag())}_SetAnyInstanceZElevated(){this._anyInstanceZElevated=
!0}_MaybeResetAnyInstanceZElevatedFlag(){0===this._instances.length&&(this._anyInstanceZElevated=!1)}_SortInstancesByLastCachedZIndex(A){if(A){A=new Set;for(var F of this._instances){var J=F.GetWorldInfo()._GetLastCachedZIndex();0<=J&&A.add(J)}F=-1;for(const B of this._instances)if(J=B.GetWorldInfo(),!(0<=J._GetLastCachedZIndex())){for(++F;A.has(F);)++F;J._SetZIndex(F)}}this._instances.sort(r)}_Start(){}_End(){for(const A of this._instances)A.GetObjectClass().IsGlobal()||this._runtime.DestroyInstance(A);
this._runtime.FlushPendingInstances();e.clearArray(this._instances);this._anyInstanceZElevated=!1;this.SetZIndicesChanged()}RecreateInitialObjects(A,F,J,B,I){const L=this._runtime.GetEventSheetManager(),Q=this._runtime.GetAllObjectClasses(),S=A.IsFamily(),U=[];for(const ma of this._initialInstances){var V=ma[0];if(F.containsPoint(V[0],V[1])){V=Q[ma[1]];if(V!==A)if(S){if(!A.FamilyHasMember(V))continue}else continue;V=this;var Z=this._runtime.GetCurrentLayout();this.GetLayout()!==Z&&((V=Z.GetLayerByName(this.GetName()))||
(V=Z.GetLayerByIndex(this.GetIndex())));Z=this._runtime.CreateInstanceFromData(ma,V,!1,void 0,void 0,!1,I);V.SortAndAddInstancesByZIndex(Z);V=Z.GetWorldInfo();V.OffsetXY(J,B);V.SetBboxChanged();L.BlockFlushingInstances(!0);Z._TriggerOnCreatedOnSelfAndRelated();L.BlockFlushingInstances(!1);U.push(Z)}}return U}GetInstanceCount(){return this._instances.length}GetLayout(){return this._layout}GetName(){return this._name}_SetIndex(A){this._index=A}GetIndex(){return this._index}GetSID(){return this._sid}GetRuntime(){return this._runtime}GetDevicePixelRatio(){return this._runtime.GetDevicePixelRatio()}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps();
return this._effectChain}_MaybeRebuildEffectChainSteps(){const A=this.HasDefaultColor();if(this._needsRebuildEffectChainSteps||A!==this._wasDefaultColor){var F=this.GetEffectList().GetActiveEffectTypes();this._effectChain.BuildSteps(F.map(J=>J.GetShaderProgram()),{indexMap:F.map(J=>J.GetIndex()),forcePreDraw:!A,useFullSurface:!0});this._needsRebuildEffectChainSteps=!1;this._wasDefaultColor=A}}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects();this._needsRebuildEffectChainSteps=!0}UsesRenderCells(){return this._useRenderCells&&
!this._useCameraDistanceDrawOrder}GetRenderGrid(){return this._renderGrid}SetRenderListStale(){this._isRenderListUpToDate=!1}IsVisible(){for(const A of this.selfAndParentLayers())if(!A._IsVisibleFlagSet())return!1;return!0}_IsVisibleFlagSet(){return this._isVisible}SetVisible(A){A=!!A;this._isVisible!==A&&(this._isVisible=A,this._runtime.UpdateRender())}SetInteractive(A){this._isInteractive=!!A}IsInteractive(){return this._isInteractive}IsSelfAndParentsInteractive(){for(const A of this.selfAndParentLayers())if(!A.IsInteractive())return!1;
return!0}SetOwnScrollPositionEnabled(A){A=!!A;if(this._hasOwnScrollPosition!==A){if(this._hasOwnScrollPosition=A)A=this.GetLayout(),this._scrollX=A.GetScrollX(),this._scrollY=A.GetScrollY();this._SetMVMatrixChanged();this._runtime.UpdateRender()}}IsOwnScrollPositionEnabled(){return this._hasOwnScrollPosition}SetScrollX(A){var F=this.GetLayout();const J=F.GetScrollLeftBound();F=F.GetScrollRightBound();A>F&&(A=F);A<J&&(A=J);this._scrollX!==A&&(this._scrollX=A,this.IsOwnScrollPositionEnabled()&&(this._SetMVMatrixChanged(),
this._runtime.UpdateRender()))}SetScrollY(A){var F=this.GetLayout();const J=F.GetScrollTopBound();F=F.GetScrollBottomBound();A>F&&(A=F);A<J&&(A=J);this._scrollY!==A&&(this._scrollY=A,this.IsOwnScrollPositionEnabled()&&(this._SetMVMatrixChanged(),this._runtime.UpdateRender()))}GetScrollX(){return this.IsOwnScrollPositionEnabled()?this._scrollX:this.GetLayout().GetScrollX()}GetScrollY(){return this.IsOwnScrollPositionEnabled()?this._scrollY:this.GetLayout().GetScrollY()}GetViewport(){return this._viewport}GetViewport3D(){return this._viewport3D}_GetVanishingPoint(){const A=
this.GetLayout();return[A.GetVanishingPointX(),A.GetVanishingPointY()]}GetDefaultCameraZ(){return this._runtime.GetDefaultCameraZ()}GetViewportForZ(A,F){var J=this._viewportZ0;if(0===A)F.copy(J);else{let Q=J.midX(),S=J.midY();var B=this.Get2DScaleFactorToZ(A);const U=J.width()/B;J=J.height()/B;const [V,Z]=this._GetVanishingPoint();if(.5!==V||.5!==Z){const ma=this.GetCameraZ();var I=this._runtime,L=this.GetDefaultCameraZ()/ma;B=(V-.5)*I.GetViewportWidth()/L;I=(Z-.5)*I.GetViewportHeight()/L;L=this.GetAngle();
0!==L&&(p.set(B,I),p.rotate(L),B=p.getX(),I=p.getY());A=e.unlerp(ma,0,A);Q+=e.lerp(B,0,A);S+=e.lerp(I,0,A)}F.set(Q-U/2,S-J/2,Q+U/2,S+J/2)}}GetOpacity(){return this._color.getA()}SetOpacity(A){A=e.clamp(A,0,1);this._color.getA()!==A&&(this._color.setA(A),this._UpdatePremultipliedColor(),this._runtime.UpdateRender())}_UpdatePremultipliedColor(){this._premultipliedColor.copy(this._color);this._premultipliedColor.premultiply()}GetPremultipliedColor(){return this._premultipliedColor}HasDefaultColor(){return this._color.equalsRgba(1,
1,1,1)}GetScaleRate(){return this._scaleRate}SetScaleRate(A){this._scaleRate!==A&&(this._scaleRate=A,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetParallaxX(){return this._parallaxX}GetParallaxY(){return this._parallaxY}SetParallax(A,F){if(this._parallaxX!==A||this._parallaxY!==F)if(this._parallaxX=A,this._parallaxY=F,this._SetMVMatrixChanged(),this._runtime.UpdateRender(),1!==this._parallaxX||1!==this._parallaxY)for(const J of this._instances)J.GetObjectClass()._SetAnyInstanceParallaxed(!0)}SetParallaxX(A){this.SetParallax(A,
this.GetParallaxY())}SetParallaxY(A){this.SetParallax(this.GetParallaxX(),A)}SetZElevation(A){this._zElevation!==A&&(this._zElevation=A,this._runtime.UpdateRender())}GetZElevation(){return this._zElevation}SetAngle(A){A=e.clampAngle(A);this._angle!==A&&(this._angle=A,this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetAngle(){return e.clampAngle(this._layout.GetAngle()+this._angle)}GetOwnAngle(){return this._angle}HasInstances(){return 0<this._instances.length}_GetInstances(){return this._instances}_GetInstancesInDrawOrder(){return this.RendersIn3DMode()&&
this._useCameraDistanceDrawOrder?(e.shallowAssignArray(G,this._GetInstances()),G.sort((A,F)=>this._SortInstancesByCameraDistance(A,F)),G):this._GetInstances()}_AppendAllInstancesIncludingSubLayersInDrawOrder(A){e.appendArray(A,this._GetInstancesInDrawOrder());for(const F of this._subLayers)F.IsVisible()&&0<F.GetOpacity()&&F._AppendAllInstancesIncludingSubLayersInDrawOrder(A)}_SortInstancesByCameraDistance(A,F){var J=this.GetLayout().Get3DCameraPosition(),B=J[0],I=J[1];J=J[2];var L=A.GetWorldInfo();
const Q=F.GetWorldInfo();F=L.GetX()-B;A=L.GetY()-I;L=L.GetZElevation()-J;B=Q.GetX()-B;I=Q.GetY()-I;J=Q.GetZElevation()-J;return B*B+I*I+J*J-(F*F+A*A+L*L)}GetBackgroundColor(){return this._backgroundColor}IsTransparent(){return this._isTransparent}SetTransparent(A){A=!!A;this._isTransparent!==A&&(this._isTransparent=A,this._runtime.UpdateRender())}IsForceOwnTexture(){return this._isForceOwnTexture}SetForceOwnTexture(A){A=!!A;this._isForceOwnTexture!==A&&(this._isForceOwnTexture=A,this._runtime.UpdateRender())}RendersIn2DMode(){return!this.GetRuntime().Uses3DFeatures()||
!this._renderAs3d}RendersIn3DMode(){return!this.RendersIn2DMode()}Has3DCamera(){return this.RendersIn3DMode()&&this.GetLayout().Is3DCameraEnabled()}SelfAndAllSubLayersHave3DCamera(){if(!this.Has3DCamera())return!1;for(const A of this._subLayers)if(!A.SelfAndAllSubLayersHave3DCamera())return!1;return!0}SetBlendMode(A){this._blendMode!==A&&(this._blendMode=A,this._runtime.UpdateRender())}GetBlendMode(){return this._blendMode}IsRootLayer(){return!this._parentLayer}GetParentLayer(){return this._parentLayer}GetSubLayers(){return this._subLayers}HasAnySubLayers(){return 0<
this._subLayers.length}HasAnyVisibleSubLayer(){for(const A of this._subLayers)if(A.ShouldDraw())return!0;return!1}*selfAndAllSubLayers(){for(const A of this._subLayers)yield*A.selfAndAllSubLayers();yield this}*parentLayers(){let A=this.GetParentLayer();for(;A;)yield A,A=A.GetParentLayer()}*selfAndParentLayers(){yield this;yield*this.parentLayers()}IsTransformCompatibleWith(A){return this===A||this._parallaxX===A._parallaxX&&this._parallaxY===A._parallaxY&&this._scale===A._scale&&this._scaleRate===
A._scaleRate&&this._angle===A._angle&&this.GetScrollX()===A.GetScrollX()&&this.GetScrollY()===A.GetScrollY()}SaveTransform(){return{parallaxX:this.GetParallaxX(),parallaxY:this.GetParallaxY(),scale:this.GetOwnScale(),scaleRate:this.GetScaleRate(),angle:this.GetOwnAngle(),hasOwnScroll:this.IsOwnScrollPositionEnabled(),scrollX:this.GetScrollX(),scrollY:this.GetScrollY()}}RestoreTransform(A){this.SetParallax(A.parallaxX,A.parallaxY);this.SetOwnScale(A.scale);this.SetScaleRate(A.scaleRate);this.SetAngle(A.angle);
this.SetOwnScrollPositionEnabled(A.hasOwnScroll);this.SetScrollX(A.scrollX);this.SetScrollY(A.scrollY)}_RemoveAllInstancesInSet(A){0!==A.size&&0<e.arrayRemoveAllInSet(this._instances,A)&&(this._MaybeResetAnyInstanceZElevatedFlag(),this.SetZIndicesChanged())}SetZIndicesChanged(){this._isRenderListUpToDate=this._zIndicesUpToDate=!1}_UpdateZIndices(){if(!this._zIndicesUpToDate){this._instances.sort(x);if(this.UsesRenderCells())for(let A=0,F=this._instances.length;A<F;++A){const J=this._instances[A].GetWorldInfo();
J._SetZIndex(A);this._renderGrid.MarkRangeChanged(J.GetRenderCellRange())}else for(let A=0,F=this._instances.length;A<F;++A)this._instances[A].GetWorldInfo()._SetZIndex(A);this._zIndicesUpToDate=!0}}MoveInstanceAdjacent(A,F,J){var B=A.GetWorldInfo();F=F.GetWorldInfo();if(B.GetLayer()!==this||F.GetLayer()!==this)throw Error("can't arrange Z order unless both objects on this layer");B=B.GetZIndex();F=F.GetZIndex();if(B===F+(J?1:-1))return!1;e.arrayRemove(this._instances,B);B<F&&F--;J&&F++;F===this._instances.length?
this._instances.push(A):this._instances.splice(F,0,A);this.SetZIndicesChanged();return!0}_MergeSortedZArrays(A,F){const J=[];let B=0,I=0,L=A.length,Q=F.length;for(;B<L&&I<Q;){const S=A[B],U=F[I];S.GetWorldInfo()._GetLastCachedZIndex()<U.GetWorldInfo()._GetLastCachedZIndex()?(J.push(S),++B):(J.push(U),++I)}for(;B<L;++B)J.push(A[B]);for(;I<Q;++I)J.push(F[I]);return J}_MergeAllSortedZArrays_pass(A){const F=[],J=A.length;for(let B=0;B<J-1;B+=2)F.push(this._MergeSortedZArrays(A[B],A[B+1]));1===J%2&&F.push(A[J-
1]);return F}_MergeAllSortedZArrays(A){for(;1<A.length;)A=this._MergeAllSortedZArrays_pass(A);return A[0]}_GetRenderCellInstancesToDraw(){this._UpdateZIndices();e.clearArray(d);this._renderGrid.QueryRange(this._viewport,d);return d.length?1===d.length?d[0]:this._MergeAllSortedZArrays(d):[]}ShouldDraw(){return this.IsVisible()&&0<this.GetOpacity()&&this._DrawsAnyContentInSelfOrSubLayers()}_DrawsAnyContentInSelfOrSubLayers(){if(this.HasInstances()||!this.IsTransparent())return!0;for(const A of this._subLayers)if(A._DrawsAnyContentInSelfOrSubLayers())return!0;
return!1}UsesOwnTexture(){return this.IsForceOwnTexture()||!this.HasDefaultColor()||0!==this.GetBlendMode()||this._effectList.HasAnyActiveEffect()}SelfOrAnySubLayerUsesOwnTexture(){if(this.UsesOwnTexture())return!0;for(const A of this._subLayers)if(A.SelfOrAnySubLayerUsesOwnTexture())return!0;return!1}GetRenderTarget(){return this._curRenderTarget}Get2DScaleFactorToZ(A){if(this._layout.IsOrthographicProjection())return 1;{const F=this.GetCameraZ();return F/(F-A)}}GetCameraZ(){return this.GetDefaultCameraZ()/
this.GetNormalScale()}_SetMVMatrixChanged(){this._isViewFrustumChanged=this._isMVMatrixChanged=!0}_GetModelViewMatrix(A){this._isMVMatrixChanged&&(this._CalculateModelViewMatrix(A,this._modelViewMatrix,0,0,null),this._isMVMatrixChanged=!1);return this._modelViewMatrix}GetCameraPosition(){if(this.Has3DCamera()){const A=this.GetLayout().Get3DCameraPosition();return[A[0],A[1],A[2]]}return this._Get2DCameraPosition()}_Get2DCameraPosition(A=0,F=0){var J=this._runtime,B=this.GetLayout(),I=J.GetParallaxXOrigin(),
L=J.GetParallaxYOrigin();I=(this.GetScrollX()-I)*this._parallaxX+I;L=(this.GetScrollY()-L)*this._parallaxY+L;J.IsPixelRoundingEnabled()&&(I=Math.round(I),L=Math.round(L));A=I+A;F=L+F;B=B.IsOrthographicProjection()?this.GetDefaultCameraZ():this.GetCameraZ();const [Q,S]=this._GetVanishingPoint();if(.5!==Q||.5!==S)I=this.GetDefaultCameraZ()/B,L=(Q-.5)*J.GetViewportWidth()/I,J=(S-.5)*J.GetViewportHeight()/I,I=this.GetAngle(),0!==I&&(p.set(L,J),p.rotate(I),L=p.getX(),J=p.getY()),A+=L,F+=J;return[A,F,B]}_CalculateModelViewMatrix(A,
F,J,B,I){const L=this._runtime;var Q=this.GetLayout();if(this.Has3DCamera()){f.copy(w,Q.Get3DCameraPosition());f.copy(q,Q.Get3DCameraLookAt());f.copy(t,Q.Get3DCameraUpVector());J=L.GetParallaxXOrigin();B=L.GetParallaxYOrigin();Q=q[0]-w[0];const S=q[1]-w[1],U=q[2]-w[2];w[0]=(w[0]-J)*this._parallaxX+J;w[1]=(w[1]-B)*this._parallaxY+B;w[2]*=Math.max(this._parallaxX,this._parallaxY);q[0]=w[0]+Q;q[1]=w[1]+S;q[2]=w[2]+U}else{const [S,U,V]=this._Get2DCameraPosition(J,B);f.set(w,S,U,V);f.set(q,S,U,V-100);
J=this.GetAngle();0===J?f.set(t,0,1,0):f.set(t,Math.sin(J),Math.cos(J),0)}A.CalculateLookAtModelView(F,w,q,t,I||L.GetViewportHeight())}_SetProjectionMatrixChanged(){this._isViewFrustumChanged=this._isProjectionMatrixChanged=!0}_GetProjectionMatrix(A){this._isProjectionMatrixChanged&&(this._CalculateProjectionMatrix(A),this._isProjectionMatrixChanged=!1);return this._projectionMatrix}_CalculateProjectionMatrix(A){var F=this._runtime.GetCanvasManager();const [J,B]=this._GetVanishingPoint();if(this._layout.IsOrthographicProjection())A.CalculateOrthographicMatrix(this._projectionMatrix,
F.GetDrawWidth(),F.GetDrawHeight());else if(.5===J&&.5===B)g.copy(this._projectionMatrix,F.GetDefaultProjectionMatrix());else{const I=F.GetDrawWidth();F=F.GetDrawHeight();A.CalculatePerspectiveMatrix(this._projectionMatrix,I/F,J,B)}}_SetTransform(A,F=!0,J=0,B=0,I=0){F&&A.SetProjectionMatrix(this._GetProjectionMatrix(A));0===J&&0===B&&0===I?F=this._GetModelViewMatrix(A):(this._CalculateModelViewMatrix(A,l,J,B,I),F=l);A.SetModelViewMatrix(F)}PrepareForDraw(A){this._SetTransform(A);A.SetBaseZ(this.GetZElevation())}Draw(A,
F,J){var B=this._runtime.GetCanvasManager();const I=this.UsesOwnTexture();var L=null;let Q=null;if(this._runtime.IsGPUProfiling())if(A.IsWebGL()){const S=B.GetLayerTimingsBuffer(this);S&&(Q=S.AddTimeElapsedQuery(),A.StartQuery(Q))}else A.IsWebGPU()&&A.WriteTimestamp(2*(this.GetIndex()+1));I?(L={sampling:this._runtime.GetSampling()},"low"===B.GetCurrentFullscreenScalingQuality()&&(L.width=B.GetDrawWidth(),L.height=B.GetDrawHeight()),this._curRenderTarget=L=this._runtime.GetAdditionalRenderTarget(L),
A.SetRenderTarget(L),this.IsTransparent()&&A.ClearRgba(0,0,0,0)):(this._curRenderTarget=F,A.SetRenderTarget(F));this.IsTransparent()||A.Clear(this._backgroundColor);this._layout._DrawLayerList(A,this._curRenderTarget,this._subLayers,I&&this.IsTransparent());this._SetTransform(A);A.SetBaseZ(this.GetZElevation());A.SetDepthEnabled(this.RendersIn3DMode());this.GetNormalScale()>Number.EPSILON&&(this._UpdateZIndices(),B=this.UsesRenderCells()&&0===this.GetZElevation()&&!this._anyInstanceZElevated,this.Has3DCamera()?
this._DrawInstances_3DCamera(A):B?this._DrawInstances_RenderCells(A):this._DrawInstances(A,this._GetInstancesInDrawOrder()));A.SetBaseZ(0);A.SetCurrentZ(0);I&&(A.SetDepthEnabled(!1),this._DrawLayerOwnTextureToRenderTarget(A,L,F,J));Q&&A.EndQuery(Q);this._runtime.IsGPUProfiling()&&A.IsWebGPU()&&A.WriteTimestamp(2*(this.GetIndex()+1)+1);this._curRenderTarget=null}_DrawInstances(A,F){const J=this._viewport,B=this._curRenderTarget,I=this.GetLayout().IsOrthographicProjection(),L=this.GetLayout().HasVanishingPointOutsideViewport();
let Q=null;for(let S=0,U=F.length;S<U;++S){const V=F[S];if(V===Q)continue;Q=V;const Z=V.GetWorldInfo();Z.IsVisible()&&Z.IsInViewport(J,L,I)&&this._DrawInstanceMaybeWithEffects(V,Z,A,B)}}_DrawInstances_3DCamera(A){const F=this._curRenderTarget,J=this._GetViewFrustum(),B=this._GetInstancesInDrawOrder();for(let S=0,U=B.length;S<U;){var I=B[S],L=I.GetWorldInfo();if(!L.IsVisible()||!L.IsInViewport3D(J)){++S;continue}(!I.RendersToOwnZPlane()||0<L.GetDepth())&&D.push(I);var Q=I.GetWorldInfo().GetTotalZElevation();
y.push(I);let V=S+1;for(;V<U;++V){const Z=B[V],ma=Z.GetWorldInfo();if(ma.IsVisible()&&ma.IsInViewport3D(J)){if(ma.GetTotalZElevation()!==Q)break;Z.RendersToOwnZPlane()?(0<ma.GetDepth()&&D.push(Z),y.push(Z)):D.push(Z)}}if(1!==y.length||y[0].MustMitigateZFighting()){this._DrawCoplanarInstances_3DCamera(A,y);for(let Z=0,ma=D.length;Z<ma;++Z)I=D[Z],L=I.GetWorldInfo(),L._SetDrawNonBackFacesOnly(!0),this._DrawInstanceMaybeWithEffects(I,L,A,F),L._SetDrawNonBackFacesOnly(!1)}else{this._DrawInstanceMaybeWithEffects(I,
L,A,F);for(let Z=0,ma=D.length;Z<ma;++Z)L=D[Z],L!==I&&(Q=L.GetWorldInfo(),Q.GetLayer()._DrawInstanceMaybeWithEffects(L,Q,A,F))}S=V;e.clearArray(y);e.clearArray(D)}}_DrawCoplanarInstances_3DCamera(A,F){const J=this._curRenderTarget;A.CoplanarStartStencilPass();for(let L=0,Q=F.length;L<Q;++L){var B=F[L],I=B.GetWorldInfo();I._SetDrawBackFaceOnly(!0);this._DrawInstance(B,I,A)}A.CoplanarStartColorPass();for(let L=0,Q=F.length;L<Q;++L)B=F[L],I=B.GetWorldInfo(),this._DrawInstanceMaybeWithEffects(B,I,A,J),
I._SetDrawBackFaceOnly(!1);A.CoplanarRestoreStandardRendering()}_DrawInstances_RenderCells(A){var F=this._renderGrid;const J=this._curRenderCells,B=this._lastRenderCells,I=this._viewport;J.set(F.XToCell(I.getLeft()),F.YToCell(I.getTop()),F.XToCell(I.getRight()),F.YToCell(I.getBottom()));this._isRenderListUpToDate&&J.equals(B)?F=this._lastRenderList:(F=this._GetRenderCellInstancesToDraw(),this._isRenderListUpToDate=!0,B.copy(J));this._DrawInstances(A,F);F!==this._lastRenderList&&e.shallowAssignArray(this._lastRenderList,
F)}_DrawInstanceMaybeWithEffects(A,F,J,B){F.HasAnyActiveEffect()?this._DrawInstanceWithEffectsAndRestore(A,F,J,B):this._DrawInstance(A,F,J)}_DrawInstance(A,F,J){F=F.GetRendererStateGroup();J.GetCurrentStateGroup()!==F&&F.Apply();A.Draw(J)}_DrawInstanceWithEffectsAndRestore(A,F,J,B){this._DrawInstanceWithEffects(A,F,J,B,null)&&this._SetTransform(J)}_DrawInstanceWithEffects(A,F,J,B,I){const L=F.GetInstanceEffectList().GetEffectChain();L.Render(J,B,{contentObject:A,blendMode:F.GetBlendMode(),devicePixelRatio:this._runtime.GetEffectDevicePixelRatioParam(),
layerScale:this._runtime.GetEffectLayerScaleParam()*this.GetNormalScale(),layerAngle:this.GetAngle(),layoutRect:F.GetBoundingBox(),drawSurfaceRect:L.IsFastPath()?null:this._InstanceBoxToDrawSurface(F),drawContentHook:I&&I.drawContentHook,compositOffX:I&&I.compositOffX,compositOffY:I&&I.compositOffY,updateOwnProjection:I&&I.updateOwnProjection});J.SetBaseZ(this.GetZElevation());return L.DidChangeTransform()}_DrawLayerOwnTextureToRenderTarget(A,F,J,B){const I=this._effectList.GetActiveEffectTypes(),
L=this._runtime;0===I.length?(A.SetRenderTarget(J),A.SetTextureFillMode(),B&&0===this._blendMode&&this.HasDefaultColor()?A.CopyRenderTarget(F):(A.SetBlendMode(this._blendMode),A.SetColor(this._premultipliedColor),A.DrawRenderTarget(F)),A.InvalidateRenderTarget(F),L.ReleaseAdditionalRenderTarget(F)):this.GetEffectChain().Render(A,J,{contentObject:this,blendMode:this.GetBlendMode(),devicePixelRatio:L.GetEffectDevicePixelRatioParam(),layerScale:L.GetEffectLayerScaleParam()*this.GetNormalScale(),layerAngle:this.GetAngle(),
layoutRect:this.GetViewport(),drawSurfaceRect:null,invalidateRenderTargets:!0})}GetOwnScale(){return this._scale}SetOwnScale(A){this._scale!==A&&(this._scale=A,this._layout.BoundScrolling(),this._SetMVMatrixChanged(),this._runtime.UpdateRender())}GetRenderScale(){return this.GetNormalScale()*this._runtime.GetRenderScale()}GetDisplayScale(){return this.GetNormalScale()*this._runtime.GetDisplayScale()}GetNormalScale(){return(this._scale*this._layout.GetScale()-1)*this._scaleRate+1}UpdateViewport(){var A=
this._runtime.GetParallaxXOrigin(),F=this._runtime.GetParallaxYOrigin(),J=(this.GetScrollX()-A)*this._parallaxX+A,B=(this.GetScrollY()-F)*this._parallaxY+F;A=this.GetNormalScale();F=this._runtime.GetViewportWidth()/A;A=this._runtime.GetViewportHeight()/A;J-=F/2;let I=B-A/2;this._runtime.IsPixelRoundingEnabled()&&(J=Math.round(J),I=Math.round(I));B=this._viewportZ0;B.set(J,I,J+F,I+A);F=this.GetAngle();0!==F&&(b.copy(B),b.offset(-B.midX(),-B.midY()),a.setFromRotatedRect(b,F),a.getBoundingBox(b),b.offset(B.midX(),
B.midY()),B.copy(b));F=this._zElevation;this.GetViewportForZ(F,this._viewport);this.Has3DCamera()?this.CalculateViewport3D(F,this._viewport3D):this._viewport3D.copy(this._viewport)}CalculateViewport3D(A,F){var J=this._runtime.GetCanvasManager(),B=J.GetCssWidth();J=J.GetCssHeight();const [I,L]=this.CanvasCssToLayer(0,0,A),[Q,S]=this.CanvasCssToLayer(B,0,A),[U,V]=this.CanvasCssToLayer(B,J,A),[Z,ma]=this.CanvasCssToLayer(0,J,A);A=Math.min(I,Q,U,Z);B=Math.min(L,S,V,ma);J=Math.max(I,Q,U,Z);let va=Math.max(L,
S,V,ma);isFinite(A)||(A=-Infinity);isFinite(B)||(B=-Infinity);isFinite(J)||(J=Infinity);isFinite(va)||(va=Infinity);F.set(A,B,J,va)}CanvasCssToLayer(A,F,J=0){return this._CanvasToLayer(A,F,J,this.GetDisplayScale())}DrawSurfaceToLayer(A,F,J=0){return this._CanvasToLayer(A,F,J,this.GetRenderScale()*this.GetDevicePixelRatio())}_CanvasToLayer(A,F,J,B){var I=this._runtime,L=I.GetRenderer();const Q=this.GetNormalScale(),S=I.GetViewportWidth()/Q;I=I.GetViewportHeight()/Q;h.set(u,0,0,S,I);A/=B;F=u[3]-F/B;
B=this._GetProjectionMatrix(L);L=this._GetModelViewMatrix(L);return e.Gfx.UnprojectScreenToWorldZ(A,F,J,L,B,u,m)?[m[0],m[1]]:[NaN,NaN]}CanvasCssToLayer_DefaultTransform(A,F){const J=this._scale,B=this._scaleRate,I=this._parallaxX,L=this._parallaxY,Q=this._angle;this._parallaxY=this._parallaxX=this._scaleRate=this._scale=1;this._angle=0;this._SetMVMatrixChanged();A=this.CanvasCssToLayer(A,F);this._scale=J;this._scaleRate=B;this._parallaxX=I;this._parallaxY=L;this._angle=Q;this._SetMVMatrixChanged();
return A}LayerToCanvasCss(A,F,J=0){return this._LayerToCanvas(A,F,J,this.GetDisplayScale())}LayerToDrawSurface(A,F,J=0){return this._LayerToCanvas(A,F,J,this.GetRenderScale()*this.GetDevicePixelRatio())}_LayerToCanvas(A,F,J,B){var I=this._runtime,L=I.GetRenderer();const Q=this.GetNormalScale();var S=I.GetViewportWidth()/Q;I=I.GetViewportHeight()/Q;h.set(u,0,0,S,I);S=this._GetProjectionMatrix(L);L=this._GetModelViewMatrix(L);return e.Gfx.Project(A,F,J,L,S,u,m)?[m[0]*B,(u[3]-m[1])*B]:[NaN,NaN]}_GetLayerToDrawSurfaceScale(A,
F){A*=this.GetRenderScale()*this.GetDevicePixelRatio();0!==F&&(A*=this.Get2DScaleFactorToZ(F));return A}_InstanceBoxToDrawSurface(A){var F=A.GetBoundingBox(),J=A.GetTotalZElevation();A=A.GetDepth();const B=J+A,I=F.getLeft(),L=F.getTop(),Q=F.getRight();F=F.getBottom();if(this.Has3DCamera()){if(this._IsPointBehindNearPlane(I,L,J)||this._IsPointBehindNearPlane(Q,L,J)||this._IsPointBehindNearPlane(Q,F,J)||this._IsPointBehindNearPlane(I,F,J)||0<A&&(this._IsPointBehindNearPlane(I,L,B)||this._IsPointBehindNearPlane(Q,
L,B)||this._IsPointBehindNearPlane(Q,F,B)||this._IsPointBehindNearPlane(I,F,B)))return null}else if(B>=this.GetCameraZ())return null;let [S,U]=this.LayerToDrawSurface(I,L,J),[V,Z]=this.LayerToDrawSurface(Q,F,J);if(0!==this.GetAngle()||0<A){const [ma,va]=this.LayerToDrawSurface(Q,L,J),[Na,Ea]=this.LayerToDrawSurface(I,F,J);if(0<A){const [Ia,Ma]=this.LayerToDrawSurface(I,L,B),[Fa,ya]=this.LayerToDrawSurface(Q,L,B),[na,Va]=this.LayerToDrawSurface(Q,F,B),[xa,Ga]=this.LayerToDrawSurface(I,F,B);J=Math.min(S,
V,ma,Na,Ia,Fa,na,xa);V=Math.max(S,V,ma,Na,Ia,Fa,na,xa);S=J;J=Math.min(U,Z,va,Ea,Ma,ya,Va,Ga);Z=Math.max(U,Z,va,Ea,Ma,ya,Va,Ga);U=J}else J=Math.min(S,V,ma,Na),V=Math.max(S,V,ma,Na),S=J,J=Math.min(U,Z,va,Ea),Z=Math.max(U,Z,va,Ea),U=J}b.set(S,U,V,Z);return b}_GetViewFrustum(){this._isViewFrustumChanged&&(this._UpdateViewFrustum(),this._isViewFrustumChanged=!1);return this._viewFrustum}_UpdateViewFrustum(){var A=this._runtime.GetRenderer();const F=this._GetProjectionMatrix(A);A=this._GetModelViewMatrix(A);
this._viewFrustum.CalculatePlanes(A,F)}_IsPointBehindNearPlane(A,F,J){return this._GetViewFrustum().IsBehindNearPlane(A,F,J)}_SaveToJson(){return{s:this.GetOwnScale(),a:this.GetOwnAngle(),vl:this._viewport.getLeft(),vt:this._viewport.getTop(),vr:this._viewport.getRight(),vb:this._viewport.getBottom(),v:this._IsVisibleFlagSet(),i:this.IsInteractive(),bc:this._backgroundColor.toJSON(),t:this.IsTransparent(),sx:this._scrollX,sy:this._scrollY,hosp:this._hasOwnScrollPosition,px:this.GetParallaxX(),py:this.GetParallaxY(),
c:this._color.toJSON(),sr:this.GetScaleRate(),fx:this._effectList.SaveToJson(),cg:this._createdGlobalUids}}_LoadFromJson(A){this._scale=A.s;this._angle=A.a;this._viewport.set(A.vl,A.vt,A.vr,A.vb);this._isVisible=!!A.v;this._isInteractive=A.hasOwnProperty("i")?A.i:!0;this._backgroundColor.setFromJSON(A.bc);this._isTransparent=!!A.t;A.hasOwnProperty("sx")&&(this._scrollX=A.sx);A.hasOwnProperty("sy")&&(this._scrollY=A.sy);A.hasOwnProperty("hosp")&&(this._hasOwnScrollPosition=!!A.hosp);this._parallaxX=
A.px;this._parallaxY=A.py;this._color.setFromJSON(A.c);this._scaleRate=A.sr;e.shallowAssignArray(this._createdGlobalUids,A.cg);e.shallowAssignArray(this._initialInstances,this._startupInitialInstances);const F=new Set(this._createdGlobalUids);let J=0;for(let B=0,I=this._initialInstances.length;B<I;++B)F.has(this._initialInstances[B][2])||(this._initialInstances[J]=this._initialInstances[B],++J);e.truncateArray(this._initialInstances,J);this._effectList.LoadFromJson(A.fx);this._needsRebuildEffectChainSteps=
!0;this._SortInstancesByLastCachedZIndex(!1);this.SetZIndicesChanged()}GetILayer(){return this._iLayer}SortAndAddInstancesByZIndex(A){if(!this._instances.includes(A))if(A.HasChildren()){var F=[...A.allChildren()];F.push(A);F.sort((B,I)=>{B=B.GetWorldInfo().GetSceneGraphZIndex();I=I.GetWorldInfo().GetSceneGraphZIndex();return B-I});for(var J of F)if(J.IsInContainer())for(const B of J.siblings())F.includes(B)||(A=[...B.allChildren()],A.push(B),A.sort((I,L)=>{I=I.GetWorldInfo().GetSceneGraphZIndex();
L=L.GetWorldInfo().GetSceneGraphZIndex();return I-L}),A&&A.length&&F.splice(F.length,0,...A));for(const B of F)this._AddInstance(B,!0)}else if(this._AddInstance(A,!0),A.IsInContainer())for(F of A.siblings())if(J=[...F.allChildren()],J.push(F),J.sort((B,I)=>{B=B.GetWorldInfo().GetSceneGraphZIndex();I=I.GetWorldInfo().GetSceneGraphZIndex();return B-I}),J&&J.length)for(const B of J)this._AddInstance(B,!0)}}}
{"use strict";const e=self.C3,b=self.C3Debugger;e.New(e.Rect);e.New(e.Rect);const a=e.New(e.Rect),d=e.New(e.Color),c=self.glMatrix.vec3,f=[],h=[],g=[],l=[];function m(q,t,p,r){return q[0]===Math.fround(t)&&q[1]===Math.fround(p)&&q[2]===Math.fround(r)}let u=null;function w(q,t){u!==q&&(q.PrepareForDraw(t),u=q)}e.Layout=class extends e.DefendedBase{constructor(q,t,p){super();this._layoutManager=q;this._runtime=q.GetRuntime();this._name=p[0];this._originalWidth=p[1];this._originalHeight=p[2];this._width=
p[1];this._height=p[2];this._isUnboundedScrolling=!!p[3];this._isOrthographicProjection=!!p[4];this._vanishingPointX=p[5];this._vanishingPointY=p[6];this._eventSheetName=p[7];this._eventSheet=null;this._sid=p[8];this._index=t;this._scrollY=this._scrollX=0;this._scale=1;this._angle=0;this._initialObjectClasses=new Set;this._textureLoadedTypes=new Set;this._textureLoadPendingPromises=new Set;this._createdInstances=[];this._initialNonWorld=[];this._is3dCameraEnabled=!1;this._cam3dposition=c.create();
this._cam3dlook=c.create();this._cam3dup=c.create();this._rootLayers=[];this._allLayersFlat=[];this._layersByName=new Map;this._layersBySid=new Map;const r=this._runtime.GetCanvasManager();this._effectList=e.New(e.EffectList,this,p[11]);this._effectChain=e.New(e.Gfx.EffectChain,r.GetEffectChainManager(),{drawContent:(x,y)=>{y=y.GetContentObject().GetRenderTarget();x.ResetColor();x.DrawRenderTarget(y);x.InvalidateRenderTarget(y);r.ReleaseAdditionalRenderTarget(y)},getShaderParameters:x=>this.GetEffectList().GetEffectParametersForIndex(x)});
this._needsRebuildEffectChainSteps=!0;this._wasFullScreenQualityLow=!1;this._curRenderTarget=null;this._persistData={};this._isFirstVisit=!0;this._iLayout=new self.ILayout(this);this._userScriptDispatcher=e.New(e.Event.Dispatcher);for(const x of p[9])this._rootLayers.push(e.New(e.Layer,this,null,x));this._allLayersFlat=[...this.allLayers()];for(let x=0,y=this._allLayersFlat.length;x<y;++x)q=this._allLayersFlat[x],q._SetIndex(x),q._Init(),this._layersByName.set(q.GetName().toLowerCase(),q),this._layersBySid.set(q.GetSID(),
q);for(const x of p[10]){p=this._runtime.GetObjectClassByIndex(x[1]);if(!p)throw Error("missing nonworld object class");p.GetDefaultInstanceData()||p.SetDefaultInstanceData(x);this._initialNonWorld.push(x);this._AddInitialObjectClass(p)}}Release(){for(const q of this._allLayersFlat)q.Release();e.clearArray(this._allLayersFlat);this._textureLoadPendingPromises.clear();this._runtime=this._layoutManager=this._eventSheet=null}GetRuntime(){return this._runtime}GetName(){return this._name}GetSID(){return this._sid}GetIndex(){return this._index}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps();
return this._effectChain}_MaybeRebuildEffectChainSteps(){const q="low"===this._runtime.GetCanvasManager().GetCurrentFullscreenScalingQuality();if(this._needsRebuildEffectChainSteps||this._wasFullScreenQualityLow!==q){var t=this.GetEffectList().GetActiveEffectTypes();this._effectChain.BuildSteps(t.map(p=>p.GetShaderProgram()),{indexMap:t.map(p=>p.GetIndex()),forcePostDraw:q,useFullSurface:!0});this._needsRebuildEffectChainSteps=!1;this._wasFullScreenQualityLow=q}}UpdateActiveEffects(){this.GetEffectList().UpdateActiveEffects();
this._needsRebuildEffectChainSteps=!0}GetMinLayerScale(){let q=this._allLayersFlat[0].GetNormalScale();for(let t=1,p=this._allLayersFlat.length;t<p;++t){const r=this._allLayersFlat[t];if(0!==r.GetParallaxX()||0!==r.GetParallaxY())q=Math.min(q,r.GetNormalScale())}return q}_GetScrollBoundMarginHorizontal(){return.5*this._runtime.GetViewportWidth()/this.GetMinLayerScale()}_GetScrollBoundMarginVertical(){return.5*this._runtime.GetViewportHeight()/this.GetMinLayerScale()}GetScrollLeftBound(){return this.IsUnboundedScrolling()?
-Infinity:this._GetScrollBoundMarginHorizontal()}GetScrollRightBound(){return this.IsUnboundedScrolling()?Infinity:this.GetWidth()-this._GetScrollBoundMarginHorizontal()}GetScrollTopBound(){return this.IsUnboundedScrolling()?-Infinity:this._GetScrollBoundMarginVertical()}GetScrollBottomBound(){return this.IsUnboundedScrolling()?Infinity:this.GetHeight()-this._GetScrollBoundMarginVertical()}SetScrollX(q){const t=this.GetScrollLeftBound(),p=this.GetScrollRightBound();q>p&&(q=p);q<t&&(q=t);this._scrollX!==
q&&(this._scrollX=q,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetScrollX(){return this._scrollX}SetScrollY(q){const t=this.GetScrollTopBound(),p=this.GetScrollBottomBound();q>p&&(q=p);q<t&&(q=t);this._scrollY!==q&&(this._scrollY=q,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetScrollY(){return this._scrollY}IsUnboundedScrolling(){return this._isUnboundedScrolling}BoundScrolling(){this.SetScrollX(this.GetScrollX());this.SetScrollY(this.GetScrollY());for(const q of this._allLayersFlat)q.IsOwnScrollPositionEnabled()&&
(q.SetScrollX(q.GetScrollX()),q.SetScrollY(q.GetScrollY()))}SetVanishingPointXY(q,t){if(this._vanishingPointX!==q||this._vanishingPointY!==t)this._vanishingPointX=q,this._vanishingPointY=t,this.IsPerspectiveProjection()&&(this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetVanishingPointX(){return this.IsOrthographicProjection()?.5:this._vanishingPointX}GetVanishingPointY(){return this.IsOrthographicProjection()?.5:this._vanishingPointY}HasVanishingPointOutsideViewport(){const q=
this.GetVanishingPointX(),t=this.GetVanishingPointY();return 0>q||1<q||0>t||1<t}SetPerspectiveProjection(){this._isOrthographicProjection&&(this._isOrthographicProjection=!1,this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}SetOrthographicProjection(){this._isOrthographicProjection||(this._isOrthographicProjection=!0,this._SetAllLayersProjectionChanged(),this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}IsOrthographicProjection(){return this._isOrthographicProjection}IsPerspectiveProjection(){return!this.IsOrthographicProjection()}Set3DCameraEnabled(q){q=
!!q;this._is3dCameraEnabled!==q&&(this._is3dCameraEnabled=q,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}Is3DCameraEnabled(){return this._is3dCameraEnabled}Set3DCameraOrientation(q,t,p,r,x,y,D,G,A){m(this._cam3dposition,q,t,p)&&m(this._cam3dlook,r,x,y)&&m(this._cam3dup,D,G,A)||(c.set(this._cam3dposition,q,t,p),c.set(this._cam3dlook,r,x,y),c.set(this._cam3dup,D,G,A),this.Set3DCameraChanged())}Set3DCameraChanged(){this._SetAllLayersMVChanged();this._runtime.UpdateRender()}Get3DCameraPosition(){return this._cam3dposition}Get3DCameraLookAt(){return this._cam3dlook}Get3DCameraUpVector(){return this._cam3dup}GetScale(){return this._scale}SetScale(q){this._scale!==
q&&(this._scale=q,this._SetAllLayersMVChanged(),this.BoundScrolling(),this._runtime.UpdateRender())}SetAngle(q){q=e.clampAngle(q);this._angle!==q&&(this._angle=q,this._SetAllLayersMVChanged(),this._runtime.UpdateRender())}GetAngle(){return this._angle}GetWidth(){return this._width}SetWidth(q){!isFinite(q)||1>q||(this._width=q)}GetHeight(){return this._height}SetHeight(q){!isFinite(q)||1>q||(this._height=q)}GetEventSheet(){return this._eventSheet}*allLayers(){for(const q of this._rootLayers)yield*q.selfAndAllSubLayers()}GetLayers(){return this._allLayersFlat}GetLayerCount(){return this._allLayersFlat.length}GetLayer(q){return"number"===
typeof q?this.GetLayerByIndex(q):this.GetLayerByName(q.toString())}GetLayerByIndex(q){q=e.clamp(Math.floor(q),0,this._allLayersFlat.length-1);return this._allLayersFlat[q]}GetLayerByName(q){return this._layersByName.get(q.toLowerCase())||null}GetLayerBySID(q){return this._layersBySid.get(q)||null}_SetAllLayersProjectionChanged(){for(const q of this._allLayersFlat)q._SetProjectionMatrixChanged()}_SetAllLayersMVChanged(){for(const q of this._allLayersFlat)q._SetMVMatrixChanged()}SaveTransform(){return{scrollX:this.GetScrollX(),
scrollY:this.GetScrollY(),scale:this.GetScale(),angle:this.GetAngle(),vpX:this.GetVanishingPointX(),vpY:this.GetVanishingPointY()}}RestoreTransform(q){this.SetScrollX(q.scrollX);this.SetScrollY(q.scrollY);this.SetScale(q.scale);this.SetAngle(q.angle);this.SetVanishingPointXY(q.vpX,q.vpY)}GetLayoutBackgroundColor(){let q=this._rootLayers.filter(t=>t.ShouldDraw())[0];for(;q;){if(!q.IsTransparent())return d.copyRgb(q.GetBackgroundColor()),d.setA(1),d;if(q.UsesOwnTexture())return d.setRgba(0,0,0,0),d;
q=q.GetSubLayers().filter(t=>t.ShouldDraw())[0]}d.setRgba(0,0,0,0);return d}IsFirstVisit(){return this._isFirstVisit}_GetInitialObjectClasses(){return[...this._initialObjectClasses]}_AddInitialObjectClass(q){if(q.IsInContainer())for(const t of q.GetContainer().GetObjectTypes())this._initialObjectClasses.add(t);else this._initialObjectClasses.add(q)}_GetTextureLoadedObjectTypes(){return[...this._textureLoadedTypes]}_Load(q,t){if(q===this||!t)return Promise.resolve();q&&(e.CopySet(this._textureLoadedTypes,
q._textureLoadedTypes),q._textureLoadedTypes.clear());q=[];for(const p of this._initialObjectClasses)this._textureLoadedTypes.has(p)||(q.push(p.LoadTextures(t)),this._textureLoadedTypes.add(p));return Promise.all(q)}async MaybeLoadTexturesFor(q){if(q.IsFamily())throw Error("cannot load textures for family");var t=this._runtime.GetRenderer();!t||t.IsContextLost()||this._textureLoadedTypes.has(q)||(this._textureLoadedTypes.add(q),t=q.LoadTextures(t),this._AddPendingTextureLoadPromise(t),await t,q.OnDynamicTextureLoadComplete(),
this._runtime.UpdateRender())}_AddPendingTextureLoadPromise(q){this._textureLoadPendingPromises.add(q);q.then(()=>this._textureLoadPendingPromises.delete(q)).catch(()=>this._textureLoadPendingPromises.delete(q))}WaitForPendingTextureLoadsToComplete(){return Promise.all([...this._textureLoadPendingPromises])}MaybeUnloadTexturesFor(q){if(q.IsFamily()||0<q.GetInstanceCount())throw Error("cannot unload textures");const t=this._runtime.GetRenderer();t&&this._textureLoadedTypes.has(q)&&(this._textureLoadedTypes.delete(q),
q.ReleaseTextures(t))}_Unload(q,t){if(q!==this&&t)for(const p of this._textureLoadedTypes)p.IsGlobal()||q._initialObjectClasses.has(p)||(p.ReleaseTextures(),this._textureLoadedTypes.delete(p))}_OnWebGLContextLost(){this._textureLoadedTypes.clear()}async _StartRunning(q){const t=this._runtime,p=this._layoutManager,r=t.GetEventSheetManager();this._eventSheetName&&(this._eventSheet=r.GetEventSheetByName(this._eventSheetName),this._eventSheet._UpdateDeepIncludes());p._SetMainRunningLayout(this);this._width=
this._originalWidth;this._height=this._originalHeight;this._scrollX=t.GetOriginalViewportWidth()/2;this._scrollY=t.GetOriginalViewportHeight()/2;this.BoundScrolling();this._MoveGlobalObjectsToThisLayout(q);this._runtime.SetUsingCreatePromises(!0);this._CreateInitialInstances();this._isFirstVisit||this._CreatePersistedInstances();this._CreateAndLinkContainerInstances(this._createdInstances);this._CreateInitialNonWorldInstances();p.ClearPendingChangeLayout();t.FlushPendingInstances();this._runtime.SetUsingCreatePromises(!1);
const x=this._runtime.GetCreatePromises();await Promise.all(x);e.clearArray(x);if(!t.IsLoadingState()){for(const y of this._createdInstances)y.SetupInitialSceneGraphConnections();for(const y of this._createdInstances)y._TriggerOnCreated()}e.clearArray(this._createdInstances);await Promise.all([...this._initialObjectClasses].map(y=>y.PreloadTexturesWithInstances(this._runtime.GetRenderer())));q&&(t.Dispatcher().dispatchEvent(new e.Event("beforefirstlayoutstart")),await t.DispatchUserScriptEventAsyncWait(new e.Event("beforeprojectstart")));
await this.DispatchUserScriptEventAsyncWait(new e.Event("beforelayoutstart"));t.IsLoadingState()||await t.TriggerAsync(e.Plugins.System.Cnds.OnLayoutStart,null,null);await this.DispatchUserScriptEventAsyncWait(new e.Event("afterlayoutstart"));q&&(t.Dispatcher().dispatchEvent(new e.Event("afterfirstlayoutstart")),await t.DispatchUserScriptEventAsyncWait(new e.Event("afterprojectstart")));r._RunQueuedTriggers(p);await this.WaitForPendingTextureLoadsToComplete();this._SetAllLayersProjectionChanged();
this._SetAllLayersMVChanged();this._isFirstVisit=!1}_MoveGlobalObjectsToThisLayout(q){for(const p of this._runtime.GetAllObjectClasses())if(!p.IsFamily()&&p.IsWorldType())for(const r of p.GetInstances()){const x=r.GetWorldInfo();var t=x.GetLayer();t=e.clamp(t.GetIndex(),0,this._allLayersFlat.length-1);t=this._allLayersFlat[t];x._SetLayer(t);t._MaybeAddInstance(r)}if(!q)for(const p of this._allLayersFlat)p._SortInstancesByLastCachedZIndex(!1)}_CreateInitialInstances(){for(const q of this._allLayersFlat)q.CreateInitialInstances(this._createdInstances),
q.UpdateViewport(),q._Start()}_CreatePersistedInstances(){let q=!1;for(const [p,r]of Object.entries(this._persistData)){const x=this._runtime.GetObjectClassBySID(parseInt(p,10));if(x&&!x.IsFamily()&&x.HasPersistBehavior()){for(const y of r){var t=null;if(x.IsWorldType()&&(t=this.GetLayerBySID(y.w.l),!t))continue;t=this._runtime.CreateInstanceFromData(x,t,!1,0,0,!0);t.LoadFromJson(y);q=!0;this._createdInstances.push(t)}e.clearArray(r)}}for(const p of this._allLayersFlat)p._SortInstancesByLastCachedZIndex(!0),
p.SetZIndicesChanged();q&&(this._runtime.FlushPendingInstances(),this._runtime._RefreshUidMap())}_CreateAndLinkContainerInstances(q){for(const p of q){if(!p.IsInContainer())continue;const r=p.GetWorldInfo(),x=p.GetIID();for(const y of p.GetObjectClass().GetContainer().objectTypes())if(y!==p.GetObjectClass()){var t=y.GetInstances();t.length>x?p._AddSibling(t[x]):(t=r?this._runtime.CreateInstanceFromData(y,r.GetLayer(),!0,r.GetX(),r.GetY(),!0):this._runtime.CreateInstanceFromData(y,null,!0,0,0,!0),
this._runtime.FlushPendingInstances(),y._UpdateIIDs(),p._AddSibling(t),q.push(t))}}}_CreateInitialNonWorldInstances(){for(const q of this._initialNonWorld)this._runtime.GetObjectClassByIndex(q[1]).IsInContainer()||this._runtime.CreateInstanceFromData(q,null,!0)}_CreateGlobalNonWorlds(){const q=[],t=this._initialNonWorld;let p=0;for(let r=0,x=t.length;r<x;++r){const y=t[r],D=this._runtime.GetObjectClassByIndex(y[1]);D.IsGlobal()?D.IsInContainer()&&D.GetContainer().HasAnyWorldType()||q.push(this._runtime.CreateInstanceFromData(y,
null,!0)):(t[p]=y,++p)}e.truncateArray(t,p);this._runtime.FlushPendingInstances();this._CreateAndLinkContainerInstances(q)}RecreateInitialObjects(q,t,p,r,x,y){if(p)return p.RecreateInitialObjects(q,t,r,x,y);p=[];for(const D of this._allLayersFlat)p.push(D.RecreateInitialObjects(q,t,r,x,y));return p.flat()}async _StopRunning(){const q=this._layoutManager;this._runtime.IsLoadingState()||await this._runtime.TriggerAsync(e.Plugins.System.Cnds.OnLayoutEnd,null,null);q.SetIsEndingLayout(!0);this._runtime.GetEventSheetManager().ClearAllScheduledWaits();
this._isFirstVisit||this._SavePersistData();for(const t of this._allLayersFlat)t._End();for(const t of this._runtime.GetAllObjectClasses())if(!(t.IsGlobal()||t.IsWorldType()||t.GetPlugin().IsSingleGlobal()||t.IsFamily())){for(const p of t.GetInstances())this._runtime.DestroyInstance(p);this._runtime.FlushPendingInstances()}q.SetIsEndingLayout(!1);q.GetMainRunningLayout()===this&&q._SetMainRunningLayout(null)}_SaveInstanceToPersist(q){const t=q.GetObjectClass().GetSID().toString();this._persistData.hasOwnProperty(t)||
(this._persistData[t]=[]);this._persistData[t].push(q.SaveToJson())}_SavePersistData(){for(const q of this._allLayersFlat){q._UpdateZIndices();for(const t of q._GetInstances()){const p=t.GetObjectClass();!p.IsGlobal()&&p.HasPersistBehavior()&&this._SaveInstanceToPersist(t)}}}ResetPersistData(){this._persistData={};this._isFirstVisit=!0}GetRenderTarget(){return this._curRenderTarget}UsesOwnTexture(){const q=this._runtime,t=q.GetRenderer().IsWebGL();return"low"===q.GetCanvasManager().GetCurrentFullscreenScalingQuality()||
t&&q.UsesAnyBackgroundBlending()||"low-latency"===q.GetCompositingMode()||this._effectList.HasAnyActiveEffect()||t&&q.Uses3DFeatures()}Draw(q){const t=this._runtime.GetCanvasManager(),p=this.UsesOwnTexture();if(p){"low-latency"!==this._runtime.GetCompositingMode()&&(q.SetRenderTarget(null),q.ClearRgba(0,0,0,0));const r={sampling:this._runtime.GetSampling(),isSampled:q.IsWebGPU()||this._runtime.UsesAnyBackgroundBlending()||this._effectList.HasAnyActiveEffect()};"low"===t.GetCurrentFullscreenScalingQuality()&&
(r.width=t.GetDrawWidth(),r.height=t.GetDrawHeight());this._curRenderTarget=this._runtime.GetAdditionalRenderTarget(r)}else this._curRenderTarget=null;q.SetRenderTarget(this._curRenderTarget);q.Clear(this.GetLayoutBackgroundColor());this._runtime.Uses3DFeatures()&&q.ClearDepth();for(const r of this._allLayersFlat)r.UpdateViewport();this._DrawLayerList(q,this._curRenderTarget,this._rootLayers,!0);p&&(q.SetDepthEnabled(!1),this._DrawLayoutOwnTextureToRenderTarget(q,this._curRenderTarget));this._curRenderTarget=
null}_DrawLayerList(q,t,p,r){p=p.filter(x=>x.ShouldDraw());for(let x=0,y=p.length;x<y;){const D=p[x];if(D.SelfAndAllSubLayersHave3DCamera()&&!D.SelfOrAnySubLayerUsesOwnTexture()){f.push(D);for(let G=x+1;G<y;++G){const A=p[G];if(A.SelfAndAllSubLayersHave3DCamera()&&!A.SelfOrAnySubLayerUsesOwnTexture())f.push(p[G]);else break}if(2<=f.length||1===f.length&&f[0].HasAnyVisibleSubLayer()){this._Draw3DLayers(q,t,f);x+=f.length;e.clearArray(f);continue}e.clearArray(f)}D.Draw(q,t,r&&0===x);++x}}_DrawLayoutOwnTextureToRenderTarget(q,
t){const p=this._effectList.GetActiveEffectTypes(),r=this._runtime;0===p.length?(q.SetRenderTarget(null),q.SetTextureFillMode(),q.CopyRenderTarget(t),q.InvalidateRenderTarget(t),r.ReleaseAdditionalRenderTarget(t)):(a.set(0,0,r.GetViewportWidth(),r.GetViewportHeight()),this.GetEffectChain().Render(q,null,{contentObject:this,blendMode:3,devicePixelRatio:this._runtime.GetEffectDevicePixelRatioParam(),layerScale:this._runtime.GetEffectLayerScaleParam()*this.GetScale(),layerAngle:this.GetAngle(),layoutRect:a,
drawSurfaceRect:null,invalidateRenderTargets:!0}))}_Draw3DLayers(q,t,p){p[0].IsTransparent()||(d.copyRgb(p[0].GetBackgroundColor()),d.setA(1),q.Clear(d));var r=this._runtime.GetCanvasManager();q.SetDepthEnabled(!0);for(var x of p)x._UpdateZIndices(),x._AppendAllInstancesIncludingSubLayersInDrawOrder(h);p=p[0];x=null;if(this._runtime.IsGPUProfiling())if(q.IsWebGL()){if(r=r.GetLayerTimingsBuffer(p))x=r.AddTimeElapsedQuery(),q.StartQuery(x)}else q.IsWebGPU()&&q.WriteTimestamp(2*(p.GetIndex()+1));for(let F=
0,J=h.length;F<J;){var y=h[F],D=y.GetWorldInfo(),G=D.GetLayer();if(D.IsVisible()&&D.IsInViewport3D(G._GetViewFrustum())){(!y.RendersToOwnZPlane()||0<D.GetDepth())&&l.push(y);var A=y.GetWorldInfo().GetTotalZElevation();g.push(y);for(r=F+1;r<J;++r){const B=h[r],I=B.GetWorldInfo();if(I.IsVisible()&&I.IsInViewport3D(I.GetLayer()._GetViewFrustum())){if(I.GetTotalZElevation()!==A)break;B.RendersToOwnZPlane()?(0<I.GetDepth()&&l.push(B),g.push(B)):l.push(B)}}if(1!==g.length||g[0].MustMitigateZFighting()){this._Draw3DLayersCoplanarInstances(q,
t,g);for(let B=0,I=l.length;B<I;++B)y=l[B],D=y.GetWorldInfo(),G=D.GetLayer(),D._SetDrawNonBackFacesOnly(!0),w(G,q),G._DrawInstanceMaybeWithEffects(y,D,q,t),D._SetDrawNonBackFacesOnly(!1)}else{w(G,q);G._DrawInstanceMaybeWithEffects(y,D,q,t);for(let B=0,I=l.length;B<I;++B)D=l[B],D!==y&&(G=D.GetWorldInfo(),A=G.GetLayer(),w(A,q),A._DrawInstanceMaybeWithEffects(D,G,q,t))}F=r;e.clearArray(g);e.clearArray(l)}else++F}x&&q.EndQuery(x);this._runtime.IsGPUProfiling()&&q.IsWebGPU()&&q.WriteTimestamp(2*(p.GetIndex()+
1)+1);e.clearArray(h);u=null}_Draw3DLayersCoplanarInstances(q,t,p){q.CoplanarStartStencilPass();for(let D=0,G=p.length;D<G;++D){var r=p[D],x=r.GetWorldInfo(),y=x.GetLayer();x._SetDrawBackFaceOnly(!0);w(y,q);y._DrawInstance(r,x,q)}q.CoplanarStartColorPass();for(let D=0,G=p.length;D<G;++D)r=p[D],x=r.GetWorldInfo(),y=x.GetLayer(),w(y,q),y._DrawInstanceMaybeWithEffects(r,x,q,t),x._SetDrawBackFaceOnly(!1);q.CoplanarRestoreStandardRendering()}_SaveToJson(){const q={sx:this.GetScrollX(),sy:this.GetScrollY(),
s:this.GetScale(),a:this.GetAngle(),w:this.GetWidth(),h:this.GetHeight(),ortho:this.IsOrthographicProjection(),vpX:this.GetVanishingPointX(),vpY:this.GetVanishingPointY(),fv:this._isFirstVisit,persist:this._persistData,fx:this._effectList.SaveToJson(),layers:{}};for(const t of this._allLayersFlat)q.layers[t.GetSID().toString()]=t._SaveToJson();return q}_LoadFromJson(q){this._scrollX=q.sx;this._scrollY=q.sy;this._scale=q.s;this._angle=q.a;this._width=q.w;this._height=q.h;this._isOrthographicProjection=
!!q.ortho;q.hasOwnProperty("vpX")&&(this._vanishingPointX=q.vpX);q.hasOwnProperty("vpY")&&(this._vanishingPointY=q.vpY);this._isFirstVisit=!!q.fv;this._persistData=q.persist;this._effectList.LoadFromJson(q.fx);this._needsRebuildEffectChainSteps=!0;for(const [t,p]of Object.entries(q.layers))q=parseInt(t,10),(q=this.GetLayerBySID(q))&&q._LoadFromJson(p);this._SetAllLayersProjectionChanged();this._SetAllLayersMVChanged()}GetILayout(){return this._iLayout}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(q){q.layout=
this.GetILayout();var t=this._runtime;(t=t.IsDebug()&&!t.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(q);t&&b.AddScriptTime()}DispatchUserScriptEventAsyncWait(q){q.layout=this.GetILayout();return this._userScriptDispatcher.dispatchEventAndWaitAsync(q)}}}
{"use strict";const e=self.C3;e.LayoutManager=class extends e.DefendedBase{constructor(b){super();this._runtime=b;this._allLayouts=[];this._layoutsByName=new Map;this._layoutsBySid=new Map;this._mainRunningLayout=null;this._runningSubLayouts=[];this._firstLayout=null;this._isEndingLayout=0;this._pendingChangeLayout=null}Release(){this._pendingChangeLayout=this._firstLayout=this._mainRunningLayout=this._runtime=null;e.clearArray(this._allLayouts);this._layoutsByName.clear();this._layoutsBySid.clear();
e.clearArray(this._runningSubLayouts)}Create(b){b=e.New(e.Layout,this,this._allLayouts.length,b);this._allLayouts.push(b);this._layoutsByName.set(b.GetName().toLowerCase(),b);this._layoutsBySid.set(b.GetSID(),b)}GetRuntime(){return this._runtime}SetFirstLayout(b){this._firstLayout=b}GetFirstLayout(){if(this._firstLayout)return this._firstLayout;if(this._allLayouts.length)return this._allLayouts[0];throw Error("no first layout");}GetLayoutByName(b){return this._layoutsByName.get(b.toLowerCase())||
null}GetLayoutBySID(b){return this._layoutsBySid.get(b)||null}GetLayoutByIndex(b){b=e.clamp(Math.floor(b),0,this._allLayouts.length-1);return this._allLayouts[b]}GetLayout(b){return"number"===typeof b?this.GetLayoutByIndex(b):this.GetLayoutByName(b.toString())}GetAllLayouts(){return this._allLayouts}_SetMainRunningLayout(b){this._mainRunningLayout=b}GetMainRunningLayout(){return this._mainRunningLayout}_AddRunningSubLayout(b){if(this._runningSubLayouts.includes(b))throw Error("layout already running");
this._runningSubLayouts.push(b)}_RemoveRunningSubLayout(b){b=this._runningSubLayouts.indexOf(b);if(-1===b)throw Error("layout not running");this._runningSubLayouts.splice(b,1)}*runningLayouts(){this._mainRunningLayout&&(yield this._mainRunningLayout);this._runningSubLayouts.length&&(yield*this._runningSubLayouts)}IsLayoutRunning(b){return this._mainRunningLayout===b||this._runningSubLayouts.includes(b)}SetIsEndingLayout(b){if(b)this._isEndingLayout++;else{if(0>=this._isEndingLayout)throw Error("already unset");
this._isEndingLayout--}}IsEndingLayout(){return 0<this._isEndingLayout}ChangeMainLayout(b){this._pendingChangeLayout=b}ClearPendingChangeLayout(){this._pendingChangeLayout=null}IsPendingChangeMainLayout(){return!!this._pendingChangeLayout}GetPendingChangeMainLayout(){return this._pendingChangeLayout}SetAllLayerProjectionChanged(){const b=this.GetMainRunningLayout();b&&b._SetAllLayersProjectionChanged()}SetAllLayerMVChanged(){const b=this.GetMainRunningLayout();b&&b._SetAllLayersMVChanged()}}}
{"use strict";const e=self.C3,b=/<(.+?)>/g;e.TimelineManager=class extends e.DefendedBase{constructor(a){super();this._runtime=a;this._timelineDataManager=e.New(e.TimelineDataManager);this._pluginInstance=null;this._timelines=[];this._timelinesByName=new Map;this._objectClassToTimelineMap=new Map;this._timelinesCreatedByTemplate=new Map;this._scheduledTimelines=[];this._playingTimelines=[];this._markedForRemovalTimelines=[];this._isTickingTimelines=this._changingLayout=this._hasRuntimeListeners=!1;
this._tickFunc=()=>this._OnTick();this._tick2Func=()=>this._OnTick2();this._beforeLayoutChange=()=>this._OnBeforeChangeLayout();this._layoutChange=()=>this._OnAfterChangeLayout();this._instanceDestroy=d=>this._OnInstanceDestroy(d.instance);this._afterLoad=d=>this._OnAfterLoad();this._destroyedWhileLoadingState=[];this._renderChange=0}Release(){this.RemoveRuntimeListeners();this._afterLoad=this._instanceDestroy=this._layoutChange=this._beforeLayoutChange=this._tick2Func=this._tickFunc=null;for(const a of this._timelines)a.Stop(),
a.Release();e.clearArray(this._timelines);this._timelines=null;this._timelineDataManager.Release();this._timelineDataManager=null;e.clearArray(this._scheduledTimelines);this._scheduledTimelines=null;e.clearArray(this._playingTimelines);this._playingTimelines=null;e.clearArray(this._markedForRemovalTimelines);this._markedForRemovalTimelines=null;this._timelinesByName.clear();this._timelinesByName=null;this._objectClassToTimelineMap.clear();this._objectClassToTimelineMap=null;this._timelinesCreatedByTemplate.clear();
this._timelinesCreatedByTemplate=null;e.clearArray(this._destroyedWhileLoadingState);this._runtime=this._destroyedWhileLoadingState=null}AddRuntimeListeners(){const a=this._runtime.Dispatcher();a.addEventListener("pretick",this._tickFunc);a.addEventListener("tick2",this._tick2Func);a.addEventListener("beforelayoutchange",this._beforeLayoutChange);a.addEventListener("layoutchange",this._layoutChange);a.addEventListener("instancedestroy",this._instanceDestroy);a.addEventListener("afterload",this._afterLoad)}RemoveRuntimeListeners(){const a=
this._runtime.Dispatcher();a.removeEventListener("pretick",this._tickFunc);a.removeEventListener("tick2",this._tick2Func);a.removeEventListener("beforelayoutchange",this._beforeLayoutChange);a.removeEventListener("layoutchange",this._layoutChange);a.removeEventListener("instancedestroy",this._instanceDestroy);a.removeEventListener("afterload",this._afterLoad)}Create(a){this._timelineDataManager.Add(a);a=e.TimelineState.CreateInitial(a,this);this.Add(a);this.SetTimelineObjectClassesToMap(a);this._timelinesCreatedByTemplate.set(a.GetName(),
0)}CreateFromTemplate(a){var d=this.GetTimelineDataManager();a=a.GetTemplateName();d=d.Get(a);d=e.TimelineState.CreateFromTemplate(`${a}:${this._timelinesCreatedByTemplate.get(a)}`,d,this);this._IncreaseTemplateTimelinesCount(a);this.Add(d);return d}_IncreaseTemplateTimelinesCount(a){this._timelinesCreatedByTemplate.set(a,this._timelinesCreatedByTemplate.get(a)+1)}_SetCreatedTemplateTimelinesCount(){for(const a of this._timelines){if(a.IsTemplate())continue;const d=a.GetTemplateName();this._IncreaseTemplateTimelinesCount(d)}}_ClearCreatedTemplateTimelinesCount(){for(const a of this._timelinesCreatedByTemplate.keys())this._timelinesCreatedByTemplate.set(a,
0)}Add(a){this._timelines.push(a);this._timelinesByName.set(a.GetName().toLowerCase(),a)}Remove(a){a.Removed();a.IsTemplate()||(e.arrayFindRemove(this._timelines,a),e.arrayFindRemove(this._scheduledTimelines,a),e.arrayFindRemove(this._playingTimelines,a),e.arrayFindRemove(this._markedForRemovalTimelines,a),this._timelinesByName.delete(a.GetName().toLowerCase()),this.RemoveTimelineFromObjectClassMap(a),a.IsReleased()||a.Release())}Trigger(a){this._runtime.Trigger(a,this._pluginInstance,null)}GetRuntime(){return this._runtime}GetTimelineDataManager(){return this._timelineDataManager}SetPluginInstance(a){this._pluginInstance=
a}GetPluginInstance(){return this._pluginInstance}*GetTimelines(){for(const a of this._timelines)yield a}SetTimelineObjectClassToMap(a,d){this._objectClassToTimelineMap.has(a)||this._objectClassToTimelineMap.set(a,new Set);this._objectClassToTimelineMap.get(a).add(d)}SetTimelineObjectClassesToMap(a){for(const d of a.GetObjectClasses())this.SetTimelineObjectClassToMap(d,a)}RemoveTimelineFromObjectClassMap(a){for(const [d,c]of this._objectClassToTimelineMap.entries())c.has(a)&&(c.delete(a),0===c.size&&
this._objectClassToTimelineMap.delete(d))}GetTimelinesForObjectClass(a){if(this._objectClassToTimelineMap.has(a))return this._objectClassToTimelineMap.get(a)}GetTimelineOfTemplateForInstances(a,d){if(d)for(const c of this._timelines)if(d.every(f=>c.HasTrackInstance(f.instance,f.trackId))&&c.GetName().includes(a.GetName()))return c}GetTimelineByName(a){return this._timelinesByName.get(a.toLowerCase())||null}GetScheduledOrPlayingTimelineByName(a){for(const d of this._scheduledTimelines)if(d.GetName()===
a)return d;for(const d of this._playingTimelines)if(d.GetName()===a)return d;return null}*GetTimelinesByName(a){if(b.test(a)){b.lastIndex=0;let c;var d=new Set;do if(c=b.exec(a)){const f=c[1].split(",");for(const h of f)d.add(h)}while(c);for(const f of d.values())(a=this.GetTimelineByName(f))&&(yield a);d.clear()}else(d=this.GetTimelineByName(a))&&(yield d)}*GetTimelinesByTags(a){for(const d of this._timelines)d.HasTags(a)&&(yield d)}AddScheduledTimeline(a){this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a);
this._MaybeEnableRuntimeListeners()}RemovePlayingTimeline(a){e.arrayFindRemove(this._playingTimelines,a);this._MaybeDisableRuntimeListeners()}ScheduleTimeline(a){this._playingTimelines.includes(a)?(a.SetPlaying(!0),a.SetScheduled(!1),a.SetMarkedForRemoval(!1)):(a.SetPlaying(!1),a.SetScheduled(!0),a.SetMarkedForRemoval(!1),this._scheduledTimelines.includes(a)||this._scheduledTimelines.push(a));this._MaybeEnableRuntimeListeners()}DeScheduleTimeline(a){a.SetPlaying(!1);a.SetScheduled(!1);a.ResolvePlayPromise();
e.arrayFindRemove(this._scheduledTimelines,a);this._MaybeDisableRuntimeListeners()}CompleteTimeline(a){a.SetPlaying(!1);a.SetScheduled(!1);this._playingTimelines.includes(a)&&(a.SetMarkedForRemoval(!0),this._markedForRemovalTimelines.push(a),e.arrayFindRemove(this._playingTimelines,a))}CompleteTimelineBeforeChangeOfLayout(a){a.SetPlaying(!1);a.SetScheduled(!1);a.SetMarkedForRemoval(!1);a.SetPlaybackRate(1);e.arrayFindRemove(this._playingTimelines,a)}CompleteTimelineAndResolve(a){this.CompleteTimeline(a);
a.ResolvePlayPromise()}_OnTick(){if(!this.GetRuntime().IsLoadingState()&&this._hasRuntimeListeners&&!this._changingLayout){for(this._isTickingTimelines=!0;this._scheduledTimelines.length;){var a=this._scheduledTimelines.pop();a.SetInitialState();0!==a.GetRenderChange()&&(this._renderChange=1);this._playingTimelines.push(a)}a=this._runtime._GetDtFast();var d=this._runtime.GetDt1(),c=this._runtime.GetTimeScale();for(let f=this._playingTimelines.length-1;0<=f;f--)this._playingTimelines[f].Tick(a,c,d);
this._isTickingTimelines=!1;0!==this._renderChange&&this.GetRuntime().UpdateRender()}}_OnTick2(){if(!this.GetRuntime().IsLoadingState()&&this._hasRuntimeListeners&&!this._changingLayout){var a;for(let d=0,c=this._markedForRemovalTimelines.length;d<c;d++){const f=this._markedForRemovalTimelines[d];a||(a=new Set);f.Removed();this._MaybeExecuteTimelineFinishTriggers(f);a.add(f)}if(a){e.arrayRemoveAllInSet(this._markedForRemovalTimelines,a);this._renderChange=0;for(let d=0,c=this._playingTimelines.length;d<
c;d++)if(0!==this._playingTimelines[d].GetRenderChange()){this._renderChange=1;break}}this._MaybeDisableRuntimeListeners()}}_MaybeExecuteTimelineFinishTriggers(a){a.IsReleased()||a.HasValidTracks()&&a.IsComplete()&&a.InitialStateSet()&&a.FinishTriggers()}_MaybeEnableRuntimeListeners(){this._hasRuntimeListeners||(this._hasRuntimeListeners=!0)}_MaybeDisableRuntimeListeners(){this._markedForRemovalTimelines.length||this._playingTimelines.length||this._scheduledTimelines.length||this._isTickingTimelines||
(this._hasRuntimeListeners=!1)}_OnBeforeChangeLayout(){for(this._changingLayout=!0;this._scheduledTimelines.length;)this.DeScheduleTimeline(this._scheduledTimelines.pop());const a=new Set;for(const d of this._playingTimelines)d._OnBeforeChangeLayout()&&(d.Removed(),a.add(d));e.arrayRemoveAllInSet(this._playingTimelines,a);a.clear();for(const d of this._markedForRemovalTimelines)d._OnBeforeChangeLayout()&&(d.Removed(),a.add(d));e.arrayRemoveAllInSet(this._markedForRemovalTimelines,a);this._MaybeDisableRuntimeListeners();
for(const d of this._timelines)d.CleanCaches()}_OnAfterChangeLayout(){this._changingLayout=!1}_OnInstanceDestroy(a){var d=a.GetObjectClass();if(d=this.GetTimelinesForObjectClass(d))if(this._runtime.IsLoadingState())this._destroyedWhileLoadingState.push(a);else for(const c of d)c.IsTemplate()||(c.IsReleased()?this.Remove(c):c.HasValidTracks()||(this._MaybeExecuteTimelineFinishTriggers(c),this.Remove(c)))}_OnAfterLoad(){for(const a of this._destroyedWhileLoadingState)this._OnInstanceDestroy(a);e.clearArray(this._destroyedWhileLoadingState)}_SaveToJson(){return{timelinesJson:this._SaveTimelinesToJson(),
scheduledTimelinesJson:this._SaveScheduledTimelinesToJson(),playingTimelinesJson:this._SavePlayingTimelinesToJson(),markedForRemovalTimelinesJson:this._SaveMarkedForRemovalTimelinesToJson(),hasRuntimeListeners:this._hasRuntimeListeners,changingLayout:this._changingLayout,isTickingTimelines:this._isTickingTimelines}}_LoadFromJson(a){a&&(this._ClearCreatedTemplateTimelinesCount(),this._LoadTimelinesFromJson(a.timelinesJson),this._LoadScheduledTimelinesFromJson(a.scheduledTimelinesJson),this._LoadPlayingTimelinesFromJson(a.playingTimelinesJson),
this._LoadMarkedForRemovalTimelinesFromJson(a.markedForRemovalTimelinesJson),this._hasRuntimeListeners=!a.hasRuntimeListeners,this._changingLayout=!!a.changingLayout,this._isTickingTimelines=!!a.isTickingTimelines,this._SetCreatedTemplateTimelinesCount(),this._MaybeEnableRuntimeListeners(),this._MaybeDisableRuntimeListeners())}_SaveTimelinesToJson(){return this._timelines.map(a=>a._SaveToJson())}_LoadTimelinesFromJson(a){for(const d of a){a=this.GetTimelineByName(d.name);if(!a){a=this._GetTemplateNameFromJson(d);
if(!a)continue;a=this.GetTimelineByName(a);a=this.CreateFromTemplate(a)}a._LoadFromJson(d);a.HasTracks()||this.Remove(a)}}_GetTemplateNameFromJson(a){return(a=a.name.split(":"))&&2===a.length?a[0]:null}_SaveScheduledTimelinesToJson(){return this._SaveTimelines(this._scheduledTimelines)}_LoadScheduledTimelinesFromJson(a){this._LoadTimelines(a,this._scheduledTimelines)}_SavePlayingTimelinesToJson(){return this._SaveTimelines(this._playingTimelines)}_LoadPlayingTimelinesFromJson(a){this._LoadTimelines(a,
this._playingTimelines)}_SaveMarkedForRemovalTimelinesToJson(){return this._SaveTimelines(this._markedForRemovalTimelines)}_LoadMarkedForRemovalTimelinesFromJson(a){this._LoadTimelines(a,this._markedForRemovalTimelines)}_IsTimelineInJson(a,d){if(!d)return!1;for(const c of d)if(c===a.GetName())return!0;return!1}_SaveTimelines(a){return a.map(d=>d.GetName())}_LoadTimelines(a,d){var c=new Set;for(const f of d)this._IsTimelineInJson(f,a)||c.add(f);e.arrayRemoveAllInSet(d,c);if(a){c=f=>h=>h.GetName()===
f;for(const f of a)(a=this.GetTimelineByName(f))&&(d.find(c(f))||d.push(a))}}}}
{"use strict";const e=self.C3;e.TimelineState=class extends e.DefendedBase{constructor(b,a,d){super();this._runtime=d.GetRuntime();this._timelineManager=d;this._timelineDataItem=a;this._name=b;this._tracks=[];this._tracksLength=0;this._beforeAndAfterTracks=null;this._beforeAndAfterTracksLength=0;this.CreateTrackStates();this._playResolve=this._playPromise=null;this._playheadTime=0;this._playbackRate=1;this._pingPongState=0;this._currentRepeatCount=1;this._initialStateSet=this._isScheduled=this._isPlaying=
!1;this._complete=!0;this._markedForRemoval=this._released=!1;this._completedTick=-1;this._firstTick=this._finishedTriggers=this._isTemplate=this._implicitPause=!1;this._lastDelta=NaN;this._tags=[""];this._stringTags="";this._tagsChanged=!1;this._hasNestedContent=this._renderChange=0}static CreateInitial(b,a){var d=a.GetTimelineDataManager();const c=d.GetNameId();d=d.Get(b[c]);b=e.New(e.TimelineState,b[c],d,a);b.SetIsTemplate(!0);return b}static CreateFromTemplate(b,a,d){return e.New(e.TimelineState,
b,a,d)}Release(){if(!this.IsReleased()){this._timelineManager.DeScheduleTimeline(this);this._timelineManager.CompleteTimelineAndResolve(this);for(const b of this._tracks)b.Release();e.clearArray(this._tracks);this._timelineDataItem=this._timelineManager=this._runtime=this._tracks=null;this._released=!0;this._playResolve=this._playPromise=null}}CreateTrackStates(){for(const b of this._timelineDataItem.GetTrackData().trackDataItems())this._tracksLength=this._tracks.push(e.TrackState.Create(this,b))}GetTimelineManager(){return this._timelineManager}GetRuntime(){return this._runtime}GetTracks(){return this._tracks}GetSimilarPropertyTracks(b,
a,d){if(this._hasNestedContent){var c;for(let h=0;h<this._tracks.length;h++){var f=this._tracks[h];b===f.GetInstance()&&(f=f.GetPropertyTrack(d))&&a.constructor===f.GetSourceAdapter().constructor&&(c||(c=[]),c.push(f))}return c}}HasTracks(){return!!this._tracks.length}GetTrackById(b){for(const a of this._tracks)if(e.equalsNoCase(a.GetId(),b))return a;return null}GetTrackByName(b){for(const a of this._tracks)if(!a.IsInstanceTrack()&&e.equalsNoCase(a.GetName(),b))return a;return null}SetName(b){this._name=
b}GetName(){return this._name}GetTimelineDataItem(){return this._timelineDataItem}GetTemplateName(){return this._timelineDataItem.GetName()}GetTotalTime(){return this._timelineDataItem.GetTotalTime()}SetTotalTime(b){this._timelineDataItem.SetTotalTime(b)}GetStep(){return this._timelineDataItem.GetStep()}SetStep(b){this._timelineDataItem.SetStep(b)}GetInterpolationMode(){return this._timelineDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._timelineDataItem.SetInterpolationMode(b)}GetResultMode(){return this._timelineDataItem.GetResultMode()}SetResultMode(b){this._timelineDataItem.GetResultMode(b)}SetEase(b){for(const a of this.GetTracks())a.SetEase(b)}GetLoop(){return this._timelineDataItem.GetLoop()}SetLoop(b){return this._timelineDataItem.SetLoop(b)}GetPingPong(){return this._timelineDataItem.GetPingPong()}SetPingPong(b){return this._timelineDataItem.SetPingPong(b)}GetRepeatCount(){return this._timelineDataItem.GetRepeatCount()}SetPlaybackRate(b){return this._playbackRate=
b}GetPlaybackRate(){return this._playbackRate}IsForwardPlayBack(){return this.IsPlaying()?0<this._playbackRate:!0}GetPlayPromise(){return this._playPromise?this._playPromise:this._playPromise=new Promise(b=>{this._playResolve=b})}ResolvePlayPromise(){this._playPromise&&(this._playResolve(),this._playResolve=this._playPromise=null)}SetTags(b){this._tags=e.TimelineState._GetTagArray(b);this._tagsChanged=!0}GetTags(){return this._tags}GetStringTags(){this._tagsChanged&&(this._stringTags=this._tags.join(" "));
this._tagsChanged=!1;return this._stringTags}HasTags(b){return this._tags&&this._tags.length?(b=e.TimelineState._GetTagArray(b))&&b.length?b.every(e.TimelineState._HasTag,this):!1:!1}OnStarted(){e.Plugins.Timeline.Cnds.SetTriggerTimeline(this);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineStarted);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineStartedByName);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineStartedByTags);this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnAnyTimelineStarted);
e.Plugins.Timeline.Cnds.SetTriggerTimeline(null)}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){this._finishedTriggers||(this._finishedTriggers=!0,e.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineFinished),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineFinishedByName),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimelineFinishedByTags),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnAnyTimelineFinished),
e.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}SetPlaying(b){this._isPlaying=b}IsCompletedTick(){return this._completedTick===this._runtime.GetTickCount()}IsPlaying(b=!1){return this.IsCompletedTick()||this.IsScheduled()&&!b?!0:this._isPlaying}_IsPlaying(){return this.IsPlaying(!0)}IsPaused(){return this._IsPaused()}_IsPaused(){return this.IsReleased()||this.IsScheduled()||this._IsPlaying()||this.IsComplete()?!1:!0}SetScheduled(b){this._isScheduled=b}IsScheduled(){return this._isScheduled}SetComplete(b){this._complete=
b;b=this.GetTime();if(0>=b||b>=this.GetTotalTime())this._complete=!0}IsComplete(){return this._complete}IsReleased(){return this._released}SetMarkedForRemoval(b){this._markedForRemoval=b}IsMarkedForRemoval(){return this._markedForRemoval}SetImplicitPause(b){this._implicitPause=b}IsImplicitPause(){return this._implicitPause}SetIsTemplate(b){this._isTemplate=!!b}IsTemplate(){return this._isTemplate}InitialStateSet(){return this._initialStateSet}GetTime(){return this._playheadTime}SetTime(b){const a=
this.GetTime();this._SetTime(b);this.SetComplete(!1);this.IsComplete()||this.SetImplicitPause(!0);if(this._IsPlaying()||this.IsScheduled()||!this._initialStateSet)this._IsPlaying()||this.IsScheduled()||this._initialStateSet?this._IsPlaying()?this.Stop():this.IsScheduled()&&(this._timelineManager.DeScheduleTimeline(this),this.SetInitialStateFromSetTime()):this.SetInitialStateFromSetTime();this._SetUpdateStateBefore();this._Interpolate(this.GetTime(),!1,!0,!0,a);this._SetUpdateStateAfter();this._renderChange&&
this.GetRuntime().UpdateRender();this._OnSetTime()}_SetTime(b){e.IsFiniteNumber(b)||(b=this.GetTotalTime());0>b?this._playheadTime=0:b>=this.GetTotalTime()?this._playheadTime=this.GetTotalTime():this._playheadTime=b}_SetTimeAndReset(b){e.IsFiniteNumber(b)||(b=this.GetTotalTime());0>b?this._playheadTime=0:b>=this.GetTotalTime()?this._playheadTime=this.GetTotalTime():this._playheadTime=b;for(const a of this._tracks)a.SetResetState()}_OnSetTime(){e.Plugins.Timeline&&this.constructor===e.TimelineState&&
(e.Plugins.Timeline.Cnds.SetTriggerTimeline(this),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimeSet),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimeSetByName),this._timelineManager.Trigger(e.Plugins.Timeline.Cnds.OnTimeSetByTags),e.Plugins.Timeline.Cnds.SetTriggerTimeline(null))}_CanResume(){if(!this.GetLoop())if(this.GetPingPong()&&1===this._pingPongState)if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return!1}else{if(0>=this.GetTime())return!1}else if(!this.GetLoop()&&
!this.GetPingPong())if(this.IsForwardPlayBack()){if(this.GetTime()>=this.GetTotalTime())return!1}else if(0>=this.GetTime())return!1;return!0}Resume(){this.IsReleased()||this._CanResume()&&this.Play(!0)}Play(b=!1){return this.IsReleased()||this.IsScheduled()?!1:this._IsPlaying()&&this.IsCompletedTick()?this._SchedulePlayingTimeline():this._IsPlaying()||!this.IsComplete()&&!b&&!this.IsImplicitPause()?!1:this._ScheduleStoppedTimeline()}_SchedulePlayingTimeline(){this.SetImplicitPause(!1);this._timelineManager.RemovePlayingTimeline(this);
this._timelineManager.ScheduleTimeline(this);this.GetPlayPromise();return!0}_ScheduleStoppedTimeline(){this.SetImplicitPause(!1);this._timelineManager.ScheduleTimeline(this);this.GetPlayPromise();return!0}Stop(b=!1){this.IsReleased()||(this.SetComplete(b),this._timelineManager.CompleteTimeline(this),this.IsComplete()&&this.ResolvePlayPromise())}Reset(b=!0,a=!1){if(!this.IsReleased()){if(!this._IsPlaying()&&this.IsScheduled())return this._timelineManager.DeScheduleTimeline(this);if(!this.IsComplete()){this.Stop(!0);
this.IsForwardPlayBack()?this._SetTime(0):this._SetTime(this.GetTotalTime());var d=this.GetTime();this._SetUpdateStateBefore();a?this._InterpolateBeforeChangeLayout(d):this._Interpolate(d,!1,!1,!0);b&&this._OnSetTime();this._SetUpdateStateAfter();this._renderChange&&b&&this.GetRuntime().UpdateRender()}}}ResetBeforeChangeLayout(){this.Reset(!1,!0)}_InterpolateBeforeChangeLayout(b){this._Interpolate(b,!1,!1,!0,NaN,!1,!0)}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;if(!this.GetRuntime().IsLoadingState()&&
this.HasValidGlobalTracks())return!1;this._timelineManager.CompleteTimelineBeforeChangeOfLayout(this);this.GetRuntime().IsLoadingState()||this.ResetBeforeChangeLayout();return!0}SetInitialStateFromSetTime(){this.SetInitialState(!0)}SetInitialState(b){if(!this.IsMarkedForRemoval()){if(b){this._firstTick=this._initialStateSet=!0;this._SetUpdateStateBefore();for(const a of this._tracks)a.SetInitialState()}else if(this.SetPlaying(!0),this.SetScheduled(!1),this.OnStarted(),this.IsComplete()){this._completedTick=
-1;this._pingPongState=0;this._currentRepeatCount=1;this._finishedTriggers=this._complete=!1;this._firstTick=this._initialStateSet=!0;this.IsForwardPlayBack()?this._SetTime(0):this._SetTime(this.GetTotalTime());this._SetUpdateStateBefore();for(const a of this._tracks)a.SetInitialState()}else{this._firstTick=!0;this._SetUpdateStateBefore();for(const a of this._tracks)a.SetResumeState()}this._SetUpdateStateAfter()}}GetRenderChange(){return this._renderChange}_SetUpdateStateBefore(){this._hasNestedContent=
0;for(const b of this._tracks)b.IsNested()&&(this._hasNestedContent=1)}_SetUpdateStateAfter(){this._renderChange=0;for(const b of this._tracks)b._SetUpdateState(),0===this._renderChange&&1===b.GetRenderChange()&&(this._renderChange=1),this._beforeAndAfterTracks||1!==b.GetNeedsBeforeAndAfter()||(this._beforeAndAfterTracks||(this._beforeAndAfterTracks=[]),this._beforeAndAfterTracksLength=this._beforeAndAfterTracks.push(b))}Tick(b,a,d){if(0!==b||0!==this._lastDelta){this._lastDelta=b;d=this._playheadTime;
a=d+b*a*this._playbackRate;b=this._timelineDataItem._totalTime;this._playheadTime=0>a?0:a>=b?b:a;var c=!1;a=!1;var f=this.GetLoop(),h=this.GetPingPong();f||h?f&&!h?0<this._playbackRate?this._playheadTime>=b&&(this._SetTimeAndReset(0),a=!0):0>=this._playheadTime&&(this._SetTimeAndReset(b),a=!0):!f&&h?0<this._playbackRate?this._playheadTime>=b&&(this._SetTime(b),this.SetPlaybackRate(-1*this.GetPlaybackRate()),a=!0,1===this._pingPongState?this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,
this._pingPongState=0):c=!0:0===this._pingPongState&&(this._pingPongState=1)):0>=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),a=!0,1===this._pingPongState?this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._pingPongState=0):c=!0:0===this._pingPongState&&(this._pingPongState=1)):f&&h&&(0<this._playbackRate?this._playheadTime>=b&&(this._SetTime(b),this.SetPlaybackRate(-1*this.GetPlaybackRate()),a=!0):0>=this._playheadTime&&(this._SetTime(0),
this.SetPlaybackRate(-1*this.GetPlaybackRate()),a=!0)):0<this._playbackRate?this._playheadTime>=b&&(this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._SetTimeAndReset(0),a=!0):(this._SetTime(b),c=!0)):0>=this._playheadTime&&(this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._SetTimeAndReset(b),a=!0):(this._SetTime(0),c=!0));f=this._tracksLength;if(c){for(c=0;c<f;c++)this._tracks[c].SetEndState();this.Stop(!0);this.OnCompleted()}else{h=this._beforeAndAfterTracksLength;
for(c=0;c<h;c++)this._beforeAndAfterTracks[c].BeforeInterpolate();if(1===this._hasNestedContent)for(c=0;c<f;c++){const g=this._tracks[c],l=g.GetStartOffset(),m=d-l;0>this._playheadTime-l&&0<m?(this._playheadTime=0>l?0:l>=b?b:l,g.Interpolate(l,!0,!1,a,this._firstTick,!1)):g.Interpolate(this._playheadTime,!0,!1,a,this._firstTick,!1)}else for(c=0;c<f;c++)this._tracks[c].Interpolate(this._playheadTime,!0,!1,a,this._firstTick,!1);for(c=0;c<h;c++)this._beforeAndAfterTracks[c].AfterInterpolate();this._firstTick&&
(this._firstTick=!1)}}}_Interpolate(b,a=!1,d=!1,c=!1,f=NaN,h=!1,g=!1){for(var l of this._tracks)l.BeforeInterpolate();for(const m of this._tracks){l=b;if("number"===typeof f&&!isNaN(f)){const u=this.GetTime()-m.GetStartOffset(),w=f-m.GetStartOffset();0>u&&0<w&&(l=m.GetStartOffset(),this._SetTime(l))}m.Interpolate(l,a,d,c,this._firstTick,g)}for(const m of this._tracks)m.AfterInterpolate();this._firstTick&&h&&(this._firstTick=!1)}AddTrack(){var b=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();
b=e.TrackState.Create(this,b);this._tracksLength=this._tracks.push(b);return b}Removed(){if(!this.IsReleased())for(const b of this._tracks)b.TimelineRemoved()}CleanCaches(){for(const b of this._tracks)b.CleanCaches()}ClearTrackInstances(){for(const b of this._tracks)b.ClearInstance()}SetTrackInstance(b,a){if(a)for(const d of this._tracks)if(d.IsInstanceTrack()){if(b){if(d.GetId()!==b)continue}else if(d.HasInstance())continue;d.SetInstance(a);this._timelineManager.SetTimelineObjectClassToMap(a.GetObjectClass(),
this);break}}HasTrackInstance(b,a){for(const d of this._tracks)if(d.IsInstanceTrack())if(a){if(a===d.GetId()&&b===d.GetInstance())return!0}else if(b===d.GetInstance())return!0;return!1}HasValidTracks(){return this._tracks.some(b=>b.IsInstanceTrack()?b.CanInstanceBeValid():!0)}HasValidGlobalTracks(){return this._tracks.some(b=>b.IsInstanceTrack()?b.CanInstanceBeValid()?(b=b.GetObjectClass())?b.IsGlobal():!1:!1:!1)}GetPropertyTrack(b){for(const a of this.GetTracks())for(const d of a.GetPropertyTracks())if(d.GetPropertyName()===
b)return d}GetTrackFromInstance(b){for(const a of this._tracks)if(b===a.GetInstance())return a;return null}GetKeyframeWithTags(b){b=b?b.split(" "):[];b=[...(new Set(b.map(a=>a.toLowerCase().trim()))).values()];for(const a of this.GetTracks())for(const d of a.GetKeyframeDataItems())if(b.every(c=>d.HasTag(c)))return d}GetObjectClasses(){const b=[];for(const a of this.GetTracks())b.push(a.GetObjectClass());return b.filter(a=>a)}_SaveToJson(){return{tracksJson:this._SaveTracksToJson(),name:this._name,
playheadTime:this.GetTime(),playbackRate:this._playbackRate,pingPongState:this._pingPongState,currentRepeatCount:this._currentRepeatCount,isPlaying:this._isPlaying,isScheduled:this._isScheduled,initialStateSet:this._initialStateSet,finishedTriggers:this._finishedTriggers,complete:this._complete,released:this._released,markedForRemoval:this._markedForRemoval,completedTick:this._completedTick,implicitPause:this._implicitPause,isTemplate:this._isTemplate,tags:this._tags.join(" "),stringTags:this._stringTags,
tagsChanged:this._tagsChanged,firstTick:this._firstTick}}_LoadFromJson(b){b&&(this._LoadTracksFromJson(b.tracksJson),this._name=b.name,this._playheadTime=b.playheadTime,this._playbackRate=b.playbackRate,this._pingPongState=b.pingPongState,this._currentRepeatCount=b.currentRepeatCount,this._isPlaying=!!b.isPlaying,this._isScheduled=!!b.isScheduled,this._initialStateSet=!!b.initialStateSet,this._finishedTriggers=b.hasOwnProperty("finishedTriggers")?!!b.finishedTriggers:!1,this._complete=!!b.complete,
this._released=!!b.released,this._markedForRemoval=!!b.markedForRemoval,this._completedTick=b.completedTick,this._implicitPause=!!b.implicitPause,this._isTemplate=!!b.isTemplate,this._tags=b.tags.split(" "),this._stringTags=b.stringTags,this._tagsChanged=!!b.tagsChanged,this._firstTick=!!b.firstTick)}_SaveTracksToJson(){return this._tracks.map(b=>b._SaveToJson())}_LoadTracksFromJson(b){b.forEach((a,d)=>{this._tracks[d]._LoadFromJson(a)});this._tracks.filter(a=>a.CanInstanceBeValid())}static _HasTag(b){const a=
this.GetTags();return""===b?1===a.length&&""===a[0]:a.includes(b)}static _GetTagArray(b){if(e.IsArray(b))return b.slice(0);if(e.IsString(b))return b.split(" ")}}}
{"use strict";const e=self.C3;e.TrackState=class extends e.DefendedBase{constructor(b,a){super();this._timeline=b;this._trackDataItem=a;this._trackData=a.GetTrackData();this._objectClassIndex=this._instanceUid=NaN;this._worldInfo=this._instance=null;this._isNested=0<a.GetStartOffset();this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this._lastKeyframeDataItem=null;this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray();this._propertyTracks=[];this.CreatePropertyTrackStates();
this._needsBeforeAndAfter=this._renderChange=this._worldInfoChange=0}static Create(b,a){return e.New(e.TrackState,b,a)}Release(){this._keyframeDataItems=null;for(const b of this._propertyTracks)b.Release();e.clearArray(this._propertyTracks);this._lastKeyframeDataItem=this._trackDataItem=this._worldInfo=this._instance=this._timeline=this._propertyTracks=null}CreatePropertyTrackStates(){for(const b of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(e.PropertyTrackState.Create(this,
b))}TimelineRemoved(){for(const b of this._propertyTracks)b.TimelineRemoved()}CleanCaches(){for(const b of this._propertyTracks)b.CleanCaches();this._worldInfo=this._instance=null}GetTimeline(){return this._timeline}GetRuntime(){return this._timeline.GetRuntime()}GetKeyframeDataItems(){return this._keyframeDataItems?this._keyframeDataItems:this._keyframeDataItems=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemArray()}GetPropertyTracks(){return this._propertyTracks}GetPropertyTrack(b){for(let a=
0;a<this._propertyTracks.length;a++){const d=this._propertyTracks[a];if(d.GetPropertyName()===b)return d}}MaybeGetInstance(){this._instance||this.GetInstance()}IsInstanceValid(){return this._instance?!this._instance.IsDestroyed():!1}CanInstanceBeValid(){if(!this.IsInstanceTrack())return!1;var b=this.GetInstanceUID();return(b=this.GetRuntime().GetInstanceByUID(b))?!b.IsDestroyed():!1}GetObjectClass(){if(this.IsInstanceTrack()){var b=this.GetObjectClassIndex();if(-1!==b)return this.GetRuntime().GetObjectClassByIndex(b)}}ClearInstance(){this._instance=
null;this._instanceUid=-1;this._worldInfo=null;this._objectClassIndex=-1}HasInstance(){return!!this._instance}GetInstance(){if(this._instance&&this.IsInstanceValid())return this._instance;const b=this.GetInstanceUID();return this._instance=this.GetRuntime().GetInstanceByUID(b)}SetInstance(b){if(this._instance!==b){this.CleanCaches();this._instance=b;this._objectClassIndex=b.GetObjectClass().GetIndex();this._instanceUid=b.GetUID();this._worldInfo=b.GetWorldInfo();for(const h of this.propertyTrackItems()){const g=
h.sourceAdapter;switch(h.propertyTrack.GetSourceAdapterId()){case "instance-variable":g.GetEditorIndex();var a=b.GetObjectClass(),d=a.GetInstanceVariableIndexByName(h.name),c=a.GetInstanceVariableName(d);a=a.GetInstanceVariableType(d);c===h.name&&a===h.type&&g.UpdateInstanceVariableIndex(d);break;case "behavior":var f=h.behaviorType;d=this.GetObjectClass();c=b.GetObjectClass();a=g.GetBehaviorType(c);f&&a&&(f=f.GetName(),d.GetBehaviorIndexByName(f),c.GetBehaviorIndexByName(f),g.GetEditorIndex(),g.UpdateBehaviorTypeSid(a.GetSID()))}}}}*propertyTrackItems(){for(const d of this._propertyTracks){var b=
d.GetSourceAdapter(),a=this.GetObjectClass();const c={propertyTrack:d,sourceAdapter:b};switch(d.GetSourceAdapterId()){case "world-instance":c.property=d.GetPropertyName();break;case "instance-variable":b=b.GetEditorIndex();c.name=a.GetInstanceVariableName(b);c.type=a.GetInstanceVariableType(b);break;case "effect":a=a.GetEffectList();b=b.GetEffectType(a);c.effectType=b;break;case "behavior":b=b.GetBehaviorType(a);c.behaviorType=b;break;case "plugin":c.plugin=a.GetPlugin()}yield c}}GetWorldInfo(){if(this._worldInfo&&
this.IsInstanceValid())return this._worldInfo;const b=this.GetInstance();b&&(this._worldInfo=b.GetWorldInfo());return this._worldInfo}GetTrackDataItem(){return this._trackDataItem}GetInstanceUID(){return this._instanceUid?this._instanceUid:this._trackDataItem.GetInstanceUID()}SetInstanceUID(b){this._trackDataItem.SetInstanceUID(b)}GetInterpolationMode(){return this._trackDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._trackDataItem.SetInterpolationMode(b)}GetResultMode(){return this._trackDataItem.GetResultMode()}GetId(){return this._trackDataItem.GetId()}GetStartOffset(){return this._trackDataItem.GetStartOffset()}GetLocalTotalTime(){return this._trackDataItem.GetLocalTotalTime()}SetLocalTotalTime(b){this._trackDataItem.SetLocalTotalTime(b)}SetResultMode(b){this._trackDataItem.SetResultMode(b)}SetEase(b){for(const a of this.GetKeyframeDataItems())a.SetEase(b);
for(const a of this.GetPropertyTracks())a.SetEase(b)}GetEnable(){return this._trackDataItem.GetEnable()}SetEnable(b){this._trackDataItem.SetEnable(b)}GetObjectClassIndex(){return isNaN(this._objectClassIndex)?this._trackDataItem.GetObjectClassIndex():this._objectClassIndex}SetObjectClassIndex(b){this._trackDataItem.SetObjectClassIndex(b)}SetOriginalWidth(b){this._trackDataItem.SetOriginalWidth(b)}GetOriginalWidth(){const b=this.GetInstance();return b&&b.GetSdkInstance().IsOriginalSizeKnown()?b.GetSdkInstance().GetOriginalWidth():
this._trackDataItem.GetOriginalWidth()}SetOriginalHeight(b){this._trackDataItem.SetOriginalHeight(b)}GetOriginalHeight(){const b=this.GetInstance();return b&&b.GetSdkInstance().IsOriginalSizeKnown()?b.GetSdkInstance().GetOriginalHeight():this._trackDataItem.GetOriginalHeight()}GetType(){return this._trackDataItem.GetType()}GetName(){return this._trackDataItem.GetName()}IsInstanceTrack(){return 0===this.GetType()}IsValueTrack(){return 1===this.GetType()}IsAudioTrack(){return 2===this.GetType()}GetWorldInfoChange(){return this._worldInfoChange}GetRenderChange(){return this._renderChange}GetNeedsBeforeAndAfter(){return this._needsBeforeAndAfter}IsNested(){return this._isNested}SetResetState(){for(const b of this._propertyTracks)b.SetResetState()}SetInitialState(){this.MaybeGetInstance();
if(this.IsInstanceValid()||!this.IsInstanceTrack()){var b=this.GetTimeline().IsForwardPlayBack()?0:this.GetLocalTotalTime();for(const a of this._propertyTracks)a.SetInitialState(b),0===this._worldInfoChange&&1===a.GetWorldInfoChange()&&(this._worldInfoChange=1),0===this._renderChange&&1===a.GetRenderChange()&&(this._renderChange=1);this._needsBeforeAndAfter=0;this._propertyTracks.some(a=>a.GetNeedsBeforeAndAfter())&&(this._needsBeforeAndAfter=1);this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(b);
this._endStateOfNestedSet=this._initialStateOfNestedSet=!1;this.Interpolate(b)}}SetResumeState(){this.MaybeGetInstance();if(this.IsInstanceValid()||!this.IsInstanceTrack()){this._timeline.IsForwardPlayBack();var b=this._timeline.GetTime()-this.GetStartOffset();this._lastKeyframeDataItem=this._GetLastKeyFrameBeforeTime(b);for(const a of this._propertyTracks)a.SetResumeState(b)}}SetEndState(){if(!(this.GetTimeline().IsComplete()||(this.MaybeGetInstance(),!this.IsInstanceValid()&&this.IsInstanceTrack()||
this._isNested))){const b=this._timeline.GetTime(),a=this.GetStartOffset()+this.GetLocalTotalTime();b>=a?this.Interpolate(this.GetLocalTotalTime(),!0,!1,!0):0>=b&&this.Interpolate(0,!0,!1,!0)}}_SetUpdateState(){for(let b=0,a=this._propertyTracks.length;b<a;b++){const d=this._propertyTracks[b];d._SetUpdateState();0===this._worldInfoChange&&1===d.GetWorldInfoChange()&&(this._worldInfoChange=1);0===this._renderChange&&1===d.GetRenderChange()&&(this._renderChange=1)}}BeforeInterpolate(){const b=this._propertyTracks.length;
for(let a=0;a<b;a++)this._propertyTracks[a].BeforeInterpolate()}Interpolate(b,a=!1,d=!1,c=!1,f=!1,h=!1){this._instance||this.GetInstance();const g=this._instance&&!this._instance.IsDestroyed(),l=0===this._trackDataItem._type;if(!(!g&&l||h&&l&&this.GetObjectClass().IsGlobal()||(b-=this.GetStartOffset(),0>b))){this.MaybeSetInitialStateOfNestedTrack(b,a);this.MaybeTriggerKeyframeReachedConditions(b,a,f);for(let m=0,u=this._propertyTracks.length;m<u;m++)this._propertyTracks[m].Interpolate(b,d,c);this.MaybeSetEndStateOfNestedTrack(b,
a);0!==this._worldInfoChange&&(this._worldInfo||(this._worldInfo=this._instance.GetWorldInfo()),this._worldInfo&&this._worldInfo.SetBboxChanged())}}AfterInterpolate(){const b=this._propertyTracks.length;for(let a=0;a<b;a++)this._propertyTracks[a].AfterInterpolate()}MaybeSetInitialStateOfNestedTrack(b,a){if(a&&this._isNested&&!this._initialStateOfNestedSet){if(this.GetTimeline().IsForwardPlayBack()){if(0>b)return;for(const d of this._propertyTracks)d.Interpolate(0,!1,!0)}else{if(b>this.GetLocalTotalTime())return;
for(const d of this._propertyTracks)d.Interpolate(this.GetLocalTotalTime(),!1,!0)}for(const d of this._propertyTracks)d.SetInitialState();this._initialStateOfNestedSet=!0}}MaybeSetEndStateOfNestedTrack(b,a){if(a&&this._isNested&&!this._endStateOfNestedSet)if(this.GetTimeline().IsForwardPlayBack()){if(b>=this.GetLocalTotalTime()){for(const d of this._propertyTracks)d.Interpolate(this.GetLocalTotalTime(),!1,!0);this._endStateOfNestedSet=!0}}else if(0>=b){for(const d of this._propertyTracks)d.Interpolate(0,
!1,!0);this._endStateOfNestedSet=!0}}MaybeTriggerKeyframeReachedConditions(b,a,d){if(!d&&a&&e.Plugins.Timeline){a=this.GetTimeline();d=this._lastKeyframeDataItem.GetNext();var c=this._lastKeyframeDataItem.GetTime(),f=d?d.GetTime():a.GetTotalTime();if(b<=c||b>=f)this._lastKeyframeDataItem=this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(b,this._trackDataItem),a.IsForwardPlayBack()?d&&this.OnKeyframeReached(this._lastKeyframeDataItem):(b=this._lastKeyframeDataItem.GetNext())&&this.OnKeyframeReached(b)}}_GetLastKeyFrameBeforeTime(b){const a=
this._trackData.GetKeyFrameDataItemAtTime(b,this._trackDataItem);return a?a:this._trackData.GetFirstKeyFrameDataItemLowerOrEqualThan(b,this._trackDataItem)}OnKeyframeReached(b){const a=this.GetTimeline();e.Plugins.Timeline.Cnds.SetTriggerTimeline(a);e.Plugins.Timeline.Cnds.SetTriggerKeyframe(b);b=a.GetTimelineManager();b.Trigger(e.Plugins.Timeline.Cnds.OnAnyKeyframeReached);b.Trigger(e.Plugins.Timeline.Cnds.OnKeyframeReached);e.Plugins.Timeline.Cnds.SetTriggerTimeline(null);e.Plugins.Timeline.Cnds.SetTriggerKeyframe(null)}AddKeyframe(){return this._trackDataItem.GetKeyframeData().AddEmptyKeyframeDataItem()}AddPropertyTrack(){var b=
this._trackDataItem.GetPropertyTrackData().AddEmptyPropertyTrackDataItem();b=e.PropertyTrackState.Create(this,b);this._propertyTracks.push(b);return b}DeleteKeyframes(b){this._trackDataItem.GetKeyframeData().DeleteKeyframeDataItems(b)}DeletePropertyKeyframes(b){for(const a of this._propertyTracks)a.DeletePropertyKeyframes(b)}SaveState(){for(const b of this._propertyTracks)b.SaveState()}CompareInitialStateWithCurrent(){this.MaybeGetInstance();if(this.IsInstanceValid()||!this.IsInstanceTrack())for(const b of this._propertyTracks)b.CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){this.MaybeGetInstance();
if(this.IsInstanceValid()||!this.IsInstanceTrack()){var b=!1;for(const a of this._propertyTracks){const d=a.CompareSaveStateWithCurrent();!b&&d&&(b=!0)}b&&(b=this.AddKeyframe(),b.SetTime(this.GetTimeline().GetTime()),b.SetEase("noease"),b.SetEnable(!0),b.SetTags(""))}}_SaveToJson(){var b=this.GetInstance();b=b?b.GetUID():this.GetInstanceUID();return{propertyTracksJson:this._SavePropertyTracksToJson(),lastKeyframeDataItemJson:this._SaveLastKeyframeDataItemToJson(),initialStateOfNestedSet:this._initialStateOfNestedSet,
endStateOfNestedSet:this._endStateOfNestedSet,instanceUid:b}}_LoadFromJson(b){b&&(this._LoadPropertyTracksFromJson(b.propertyTracksJson),this._LoadLastKeyframeDataItemFromJson(b.lastKeyframeDataItemJson),this._LoadInstanceFromJson(b.instanceUid),this._initialStateOfNestedSet=!1,b.hasOwnProperty.initialStateOfNestedSet&&(this._initialStateOfNestedSet=b.initialStateOfNestedSet),this._endStateOfNestedSet=!1,b.hasOwnProperty.endStateOfNestedSet&&(this._endStateOfNestedSet=b.endStateOfNestedSet))}_SaveLastKeyframeDataItemToJson(){return this._trackDataItem.GetKeyframeData().GetKeyframeDataItemIndex(this._lastKeyframeDataItem)}_SavePropertyTracksToJson(){return this._propertyTracks.map(b=>
b._SaveToJson())}_LoadPropertyTracksFromJson(b){b.forEach((a,d)=>{this._propertyTracks[d]._LoadFromJson(a)})}_LoadInstanceFromJson(b){if(e.IsFiniteNumber(b)&&(b=this.GetRuntime().GetInstanceByUID(b))){var a=this.GetTimeline();a.ClearTrackInstances();a.SetTrackInstance(this._trackDataItem.GetId(),b)}}_LoadLastKeyframeDataItemFromJson(b){this._lastKeyframeDataItem=this._trackDataItem.GetKeyframeData().GetKeyframeDataItemFromIndex(b)}}}
{"use strict";const e=self.C3;e.PropertyTrackState=class extends e.DefendedBase{constructor(b,a){super();this._track=b;this._propertyTrackDataItem=a;this._propertyTrackData=a.GetPropertyTrackData();this._needsBeforeAndAfter=this._renderChange=this._worldInfoChange=0;this._sourceAdapter=this.GetSourceAdapter();this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();this._absoluteValueObject=this._lastPropertyKeyframeDataItem=null}static Create(b,
a){return e.New(e.PropertyTrackState,b,a)}Release(){this._track=null;this._sourceAdapter&&(this._sourceAdapter.Release(),this._sourceAdapter=null);this._propertyTrackData=this._propertyTrackDataItem=this._propertyKeyframeDataItems=null}GetWorldInfoChange(){return this._worldInfoChange}GetRenderChange(){return this._renderChange}GetNeedsBeforeAndAfter(){return this._needsBeforeAndAfter}HasAbsoluteValueObject(){return!!this._absoluteValueObject}SetAbsoluteValueObject(b){this._absoluteValueObject=b}GetAbsoluteValueObject(){return this._absoluteValueObject}GetTrack(){return this._track}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyTrackData(){return this._propertyTrackData}GetTimeline(){return this._track.GetTimeline()}GetRuntime(){return this._track.GetRuntime()}GetInstance(){return this._track.GetInstance()}GetSourceAdapter(){if(this._sourceAdapter)return this._sourceAdapter;
let b;switch(this._propertyTrackDataItem.GetSourceAdapterId()){case "behavior":b=new e.PropertyTrackState.BehaviorSourceAdapter(this);break;case "effect":b=new e.PropertyTrackState.EffectSourceAdapter(this);this._renderChange=1;break;case "instance-variable":b=new e.PropertyTrackState.InstanceVariableSourceAdapter(this);break;case "plugin":b=new e.PropertyTrackState.PluginSourceAdapter(this);this._renderChange=1;break;case "world-instance":b=new e.PropertyTrackState.PropertySourceAdapter(this);this._worldInfoChange=
this._renderChange=1;break;case "value":b=new e.PropertyTrackState.ValueSourceAdapter(this);break;case "audio":b=new e.PropertyTrackState.AudioSourceAdapter(this)}return this._sourceAdapter=b}GetSourceAdapterId(){return this._propertyTrackDataItem.GetSourceAdapterId()}SetSourceAdapterId(b){this._propertyTrackDataItem.SetSourceAdapterId(b)}GetSourceAdapterArgs(){return this._propertyTrackDataItem.GetSourceAdapterArguments()}SetSourceAdapterArgs(b){this._propertyTrackDataItem.SetSourceAdapterArguments(b)}GetSourceAdapterValue(){return this.GetSourceAdapter().GetValue()}GetPropertyName(){return this._propertyTrackDataItem.GetProperty()}SetPropertyName(b){this._propertyTrackDataItem.SetProperty(b)}GetPropertyType(){return this._propertyTrackDataItem.GetType()}SetPropertyType(b){this._propertyTrackDataItem.SetType(b)}GetPropertyKeyframeType(){return this.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem).GetType()}GetMin(){return this._propertyTrackDataItem.GetMin()}SetMin(b){this._propertyTrackDataItem.SetMin(b)}GetMax(){return this._propertyTrackDataItem.GetMax()}SetMax(b){this._propertyTrackDataItem.SetMax(b)}GetEnable(){return this._propertyTrackDataItem.GetEnable()}SetEnable(b){this._propertyTrackDataItem.SetEnable(b)}GetInterpolationMode(){return this._propertyTrackDataItem.GetInterpolationMode()}SetInterpolationMode(b){this._propertyTrackDataItem.SetInterpolationMode(b)}GetResultMode(){return this._propertyTrackDataItem.GetResultMode()}SetResultMode(b){this._propertyTrackDataItem.SetResultMode(b)}SetEase(b){for(const a of this.GetPropertyKeyframeDataItems())a.SetEase(b)}CanHavePropertyKeyframes(){return this._propertyTrackDataItem.CanHavePropertyKeyframes()}GetPropertyKeyframeDataItems(){return this._propertyKeyframeDataItems?
this._propertyKeyframeDataItems:this._propertyKeyframeDataItems=this._propertyTrackDataItem.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()}*GetPropertyKeyframeValues(){for(const b of this.GetPropertyKeyframeDataItems())yield b.GetValueWithResultMode()}TimelineRemoved(){this.GetSourceAdapter().TimelineRemoved()}CleanCaches(){this.GetSourceAdapter().CleanCaches()}GetCurrentState(){return this.GetSourceAdapter().GetCurrentState()}SetResetState(){this.GetSourceAdapter().SetResetState()}SetInitialState(b){this.GetSourceAdapter().SetInitialState();
this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(b);this._SetUpdateState()}SetResumeState(b){this.GetSourceAdapter().SetResumeState();this._lastPropertyKeyframeDataItem=this._GetLastPropertyKeyFrameBeforeTime(b)}_SetUpdateState(){var b=this.GetTrack();this._needsBeforeAndAfter=0;if(b.IsInstanceTrack()){var a=this.GetTimeline();b=b.GetInstance();const d=this.GetSourceAdapter(),c=this.GetPropertyName();d.MayNeedBeforeAndAfterInterpolate()?(a=a.GetSimilarPropertyTracks(b,d,
c))&&a.length&&(this._needsBeforeAndAfter=1):this._needsBeforeAndAfter=0}}_GetLastPropertyKeyFrameBeforeTime(b){const a=this.GetTimeline(),d=this._propertyTrackData.GetPropertyKeyFrameDataItemAtTime(b,this._propertyTrackDataItem);return d?d:a.IsForwardPlayBack()?this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem):this._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,this._propertyTrackDataItem)}BeforeInterpolate(){this._sourceAdapter.BeforeInterpolate()}Interpolate(b,
a=!1,d=!1){let c;if(a)var f=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);else{if(this._lastPropertyKeyframeDataItem){var h=this.GetTimeline();const g=this._lastPropertyKeyframeDataItem.GetNext();f=this._lastPropertyKeyframeDataItem.GetTime();h=g?g.GetTime():h.GetTotalTime();if(b<=f||b>=h)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=
this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);f=this._lastPropertyKeyframeDataItem}f&&(c=f.GetNext());this._sourceAdapter.Interpolate(b,f,c,a,d)}GetInterpolatedValue(b){if(this._lastPropertyKeyframeDataItem){var a=this.GetTimeline();const c=this._lastPropertyKeyframeDataItem.GetNext();var d=this._lastPropertyKeyframeDataItem.GetTime();a=c?c.GetTime():a.GetTotalTime();if(b<=d||b>=a)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,
this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);d=this._lastPropertyKeyframeDataItem;a=d.GetNext();return this._sourceAdapter.GetInterpolatedValue(b,d,a)}AfterInterpolate(){this._sourceAdapter.AfterInterpolate()}static GetStartPropertyKeyframeForTime(b,a){const d=a.GetPropertyTrackDataItem();return a._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,d)}static GetEndPropertyKeyframeForTime(b,
a){const d=a.GetPropertyTrackDataItem();return a._propertyTrackData.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(b,d)}AddPropertyKeyframe(){const b=this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;return b}DeletePropertyKeyframes(b){this._lastPropertyKeyframeDataItem=null;this._propertyTrackDataItem.GetPropertyKeyframeData().DeletePropertyKeyframeDataItems(b)}SaveState(){this.GetSourceAdapter().SaveState()}CompareInitialStateWithCurrent(){if(this.GetSourceAdapter().CompareInitialStateWithCurrent()){const b=
this._propertyTrackData.GetFirstPropertyKeyframeDataItem(this._propertyTrackDataItem),a=this.GetSourceAdapter().GetCurrentState();b.SetAbsoluteValue(a)}}CompareSaveStateWithCurrent(){const b=this.GetSourceAdapter().CompareSaveStateWithCurrent();b&&this.AddPropertyKeyframeAtCurrentTime();this.GetSourceAdapter().ClearSaveState();return b}AddPropertyKeyframeAtCurrentTime(){const b=this.GetTimeline().GetTime(),a=this.GetSourceAdapter(),d=e.PropertyTrackState.GetStartPropertyKeyframeForTime(b,this),c=
this.AddPropertyKeyframe();c.SetType(d.GetType());c.SetTime(b);c.SetEase(d.GetEase());c.SetEnable(!0);c.SetValue(a.GetValueAtTime());c.SetAbsoluteValue(a.GetCurrentState())}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson()}}_LoadFromJson(b){b&&this.GetSourceAdapter()._LoadFromJson(b.sourceAdapterJson)}}}
{"use strict";const e=self.C3.PropertyTrackState;e.PropertySourceAdapter=class{constructor(b){this._propertyTrack=b;this._propertyAdapter=null;this.GetPropertyAdapter()}Release(){this._propertyAdapter&&(this._propertyAdapter.Release(),this._propertyAdapter=null);this._propertyTrack=null}MayNeedBeforeAndAfterInterpolate(){return this._propertyAdapter.MayNeedBeforeAndAfterInterpolate()}GetPropertyTrack(){return this._propertyTrack}TimelineRemoved(){this._propertyAdapter&&this._propertyAdapter.TimelineRemoved()}CleanCaches(){this._propertyAdapter&&
this._propertyAdapter.CleanCaches()}GetPropertyAdapter(){return this._propertyAdapter?this._propertyAdapter:this._propertyAdapter=this._CreatePropertyAdapter()}GetEditorIndex(){}GetIndex(){return this.GetEditorIndex()}GetTarget(){}SetResetState(){this.GetPropertyAdapter().SetResetState()}SetInitialState(){this.GetPropertyAdapter().SetInitialState()}SetResumeState(){this.GetPropertyAdapter().SetResumeState()}BeforeInterpolate(){this._propertyAdapter.BeforeChangeProperty()}Interpolate(b,a,d,c,f){let h;
switch(this._propertyTrack.GetPropertyKeyframeType()){case "numeric":h=e.NumericTypeAdapter.Interpolate(b,a,d,this._propertyTrack);break;case "angle":h=e.AngleTypeAdapter.Interpolate(b,a,d,this._propertyTrack);break;case "boolean":h=e.BooleanTypeAdapter.Interpolate(b,a,d,this._propertyTrack);break;case "color":h=e.ColorTypeAdapter.Interpolate(b,a,d,this._propertyTrack);break;case "text":h=e.TextTypeAdapter.Interpolate(b,a,d,this._propertyTrack)}this._propertyAdapter.ChangeProperty(b,h,a,d,c,f)}GetInterpolatedValue(b,
a,d){switch(this._propertyTrack.GetPropertyKeyframeType()){case "numeric":return e.NumericTypeAdapter.Interpolate(b,a,d,this._propertyTrack);case "angle":return e.AngleTypeAdapter.Interpolate(b,a,d,this._propertyTrack);case "boolean":return e.BooleanTypeAdapter.Interpolate(b,a,d,this._propertyTrack);case "color":return e.ColorTypeAdapter.Interpolate(b,a,d,this._propertyTrack);case "text":return e.TextTypeAdapter.Interpolate(b,a,d,this._propertyTrack)}}AfterInterpolate(){this._propertyAdapter.AfterChangeProperty()}SaveState(){this.GetPropertyAdapter().SetSaveState()}ClearSaveState(){this.GetPropertyAdapter().ClearSaveState()}GetCurrentState(){return this.GetPropertyAdapter().GetCurrentState()}CompareInitialStateWithCurrent(){return this.GetPropertyAdapter().CompareInitialStateWithCurrent()}CompareSaveStateWithCurrent(){return this.GetPropertyAdapter().CompareSaveStateWithCurrent()}GetValueAtTime(){const b=
this._propertyTrack,a=b.GetTrack().GetTimeline().GetTime(),d=e.GetStartPropertyKeyframeForTime(a,b),c=d.GetNext();switch(b.GetPropertyKeyframeType()){case "numeric":return e.NumericTypeAdapter.Interpolate(a,d,c,b);case "angle":return e.AngleTypeAdapter.Interpolate(a,d,c,b);case "boolean":return e.BooleanTypeAdapter.Interpolate(a,d,c,b);case "color":return e.ColorTypeAdapter.Interpolate(a,d,c,b);case "text":return e.TextTypeAdapter.Interpolate(a,d,c,b)}}_CreatePropertyAdapter(){const b=this._propertyTrack;
switch(b.CanHavePropertyKeyframes()?b.GetPropertyKeyframeType():""){case "combo":case "boolean":case "text":case "string":return new e.PropertyInterpolationAdapter.NoInterpolationAdapter(this);case "numeric":case "number":case "angle":return"combo"===this._propertyTrack.GetPropertyType()?new e.PropertyInterpolationAdapter.NoInterpolationAdapter(this):new e.PropertyInterpolationAdapter.NumericInterpolationAdapter(this);case "color":case "offsetColor":return new e.PropertyInterpolationAdapter.ColorInterpolationAdapter(this);
default:return new e.PropertyInterpolationAdapter.NumericInterpolationAdapter(this)}}_SaveToJson(){return{propertyAdapterJson:this.GetPropertyAdapter()._SaveToJson()}}_LoadFromJson(b){b&&this.GetPropertyAdapter()._LoadFromJson(b.propertyAdapterJson)}}}
{"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._updatedIndex=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetIndex(){return this._updatedIndex?this._updatedIndex:super.GetIndex()}GetTarget(){return this._propertyTrack.GetTrack().GetInstance()}UpdateInstanceVariableIndex(a){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==a&&(this._updatedIndex=
a)}Interpolate(a,d,c,f,h){this.GetPropertyAdapter().CanChange(d.GetValue())&&super.Interpolate(a,d,c,f,h)}GetInterpolatedValue(a,d,c){if(this.GetPropertyAdapter().CanChange(d.GetValue()))return super.GetInterpolatedValue(a,d,c)}_SaveToJson(){return Object.assign(super._SaveToJson(),{index:this._updatedIndex})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._updatedIndex=a.index)}}e.PropertyTrackState.InstanceVariableSourceAdapter=b}
{"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._sid=NaN}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){var a=this._propertyTrack.GetPropertyTrackDataItem(),d=this._propertyTrack.GetTrack();a=this._sid?this._sid:a.GetSourceAdapterArguments()[0];d=d.GetInstance();a=d.GetBehaviorIndexBySID(a);return d.GetBehaviorInstances()[a].GetSdkInstance()}GetBehaviorType(a){const d=
this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[2];return a.GetBehaviorTypeByName(d)}UpdateBehaviorTypeSid(a){this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]!==a&&(this._sid=a)}Interpolate(a,d,c,f,h){const g=this._propertyTrack.GetTrack().GetInstance();this.GetBehaviorType(g.GetObjectClass())&&super.Interpolate(a,d,c,f,h)}GetInterpolatedValue(a,d,c){const f=this._propertyTrack.GetTrack().GetInstance();if(this.GetBehaviorType(f.GetObjectClass()))return super.GetInterpolatedValue(a,
d,c)}_SaveToJson(){return Object.assign(super._SaveToJson(),{sid:this._sid})}_LoadFromJson(a){a&&(super._LoadFromJson(a),this._sid=a.sid)}}e.PropertyTrackState.BehaviorSourceAdapter=b}
{"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[1]}GetTarget(){const a=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var d=a.GetEffectList();d=this.GetEffectType(d).GetIndex();return a.IsEffectIndexActive(d)?a.GetEffectParametersForIndex(d):null}GetEffectType(a){const d=this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0];
return a.GetEffectTypeByName(d)}Interpolate(a,d,c,f,h){this._IsEffectActive()&&super.Interpolate(a,d,c,f,h)}GetInterpolatedValue(a,d,c){if(this._IsEffectActive())return super.GetInterpolatedValue(a,d,c)}_IsEffectActive(){const a=this._propertyTrack.GetTrack().GetWorldInfo().GetInstanceEffectList();var d=a.GetEffectList();if(d=this.GetEffectType(d))return d=d.GetIndex(),a.IsEffectIndexActive(d)}}e.PropertyTrackState.EffectSourceAdapter=b}
{"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a)}GetEditorIndex(){return this._propertyTrack.GetPropertyTrackDataItem().GetSourceAdapterArguments()[0]}GetTarget(){return this._propertyTrack.GetTrack().GetInstance().GetSdkInstance()}Interpolate(a,d,c,f,h){var g=this._propertyTrack.GetTrack();const l=g.GetObjectClass().GetPlugin();g=g.GetInstance().GetObjectClass().GetPlugin();l===g&&super.Interpolate(a,d,c,f,h)}GetInterpolatedValue(a,
d,c){var f=this._propertyTrack.GetTrack();const h=f.GetObjectClass().GetPlugin();f=f.GetInstance().GetObjectClass().GetPlugin();if(h===f)return super.GetInterpolatedValue(a,d,c)}}e.PropertyTrackState.PluginSourceAdapter=b}
{"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._value=0;this._init=!1}MayNeedBeforeAndAfterInterpolate(){return!1}SetInitialState(){const a=this._propertyTrack.GetPropertyTrackData();let d=this._propertyTrack.GetPropertyTrackDataItem();d=a.GetFirstPropertyKeyframeDataItem(d);this._value=d.GetValueWithResultMode()}SetResumeState(){}GetValue(){this._init||this._propertyTrack.Interpolate(0);return this._value}Interpolate(a,d,c,f,
h){this._value=e.PropertyTrackState.NumericTypeAdapter.Interpolate(a,d,c,this._propertyTrack);this._init=!0}SaveState(){}ClearSaveState(){}GetCurrentState(){return this._value}CompareInitialStateWithCurrent(){return!1}CompareSaveStateWithCurrent(){return!1}_SaveToJson(){return{value:this._value,init:this._init}}_LoadFromJson(a){a&&(this._value=a.value,this._init=a.hasOwnProperty("init")?a.init:!0)}}e.PropertyTrackState.ValueSourceAdapter=b}
{"use strict";const e=self.C3;class b extends e.PropertyTrackState.PropertySourceAdapter{constructor(a){super(a);this._audioPlaybackStarted=!1;this._expressions=this._actions=this._sdkInstance=null;this._timeline=this._propertyTrack.GetTimeline();this._track=this._propertyTrack.GetTrack();this._sourceAdapterArgs=this._propertyTrack.GetSourceAdapterArgs();this._fileArgs=this._sourceAdapterArgs[0];this._startOffsetTime=this._sourceAdapterArgs[1];this._audioTag=this._sourceAdapterArgs[3]?this._sourceAdapterArgs[3]:
Math.random().toString(36).slice(2);this._volume=this._pauseVolume=this._pauseTime=NaN;this._audioSource=null;this._Initialize()}Release(){super.Release();this._audioSource=this._fileArgs=this._sourceAdapterArgs=this._track=this._timeline=this._expressions=this._actions=this._sdkInstance=null}_Initialize(){if(self.C3.Plugins.Audio){var a=this._propertyTrack.GetRuntime().GetObjectClassByName("audio");a&&(this._sdkInstance=a.GetSingleGlobalInstance().GetSdkInstance());this._actions=self.C3.Plugins.Audio.Acts;
this._expressions=self.C3.Plugins.Audio.Exps}}_MaybeSetAudioSource(){if(!this._audioSource){var a=this._propertyTrack.GetTrack().GetPropertyTrack("audioSource");a&&(this._audioSource=a.GetSourceAdapter())}}_GetPauseVolume(){const a=this._propertyTrack.GetTrack().GetPropertyTrack("volume");return a?a.GetSourceAdapter()._pauseVolume:this._pauseVolume}TimelineRemoved(){super.TimelineRemoved();this._audioPlaybackStarted=!1;this._sdkInstance&&(this._expressions&&(this._pauseTime=this._expressions.PlaybackTime.call(this._sdkInstance,
this._audioTag),this._pauseVolume=this._expressions.Volume.call(this._sdkInstance,this._audioTag)),this._actions&&this._actions.Stop.call(this._sdkInstance,this._audioTag))}GetAudioTag(){return this._audioTag}GetVolume(){return this._volume}SetVolume(a){this._volume=a}SetInitialState(){super.SetInitialState();this._pauseTime=NaN;this._audioPlaybackStarted=!1}SetResumeState(){super.SetResumeState();const a=this._propertyTrack.GetTimeline().GetTime();this._pauseTime=a-this._startOffsetTime;switch(this._propertyTrack.GetPropertyName()){case "volume":this._pauseVolume=
this._propertyTrack.GetInterpolatedValue(a)}this._audioPlaybackStarted=!1}Interpolate(a,d,c,f,h){if(this._sdkInstance)switch(this._propertyTrack.GetPropertyName()){case "audioSource":if(!this._timeline.IsForwardPlayBack())break;if(f){this._actions&&this._actions.Stop.call(this._sdkInstance,this._audioTag);break}if(a<this._startOffsetTime){this._audioPlaybackStarted=!1;break}d=this._expressions.PlaybackRate.call(this._sdkInstance,this._audioTag);c=this._timeline.GetPlaybackRate();c!==d&&this._actions.SetPlaybackRate.call(this._sdkInstance,
this._audioTag,c);if(this._audioPlaybackStarted)break;this._audioPlaybackStarted=!0;if(isNaN(this._pauseTime)){const g=self.performance.now(),l=a-this._startOffsetTime;this._sdkInstance.PostToDOMAsync("get-suspended").then(m=>{if("suspended"===m)this._audioPlaybackStarted=!1;else if(m=(self.performance.now()-g)/1E3,m=l+m,this._actions){let u=this.GetVolume();isNaN(u)?(this.SetVolume(0),u=0):this.SetVolume(u);this._actions.Play.call(this._sdkInstance,this._fileArgs,0,u,this._audioTag,m)}})}else{const g=
this._pauseTime;this._pauseTime=NaN;const l=this._GetPauseVolume();this._pauseVolume=NaN;this._sdkInstance.PostToDOMAsync("get-suspended").then(m=>{"suspended"===m?this._audioPlaybackStarted=!1:this._actions&&(this.SetVolume(l),this._actions.Play.call(this._sdkInstance,this._fileArgs,0,l,this._audioTag,g))})}break;case "volume":this._MaybeSetAudioSource(),super.Interpolate(a,d,c,f,h)}}GetInterpolatedValue(a,d,c){if(this._sdkInstance)switch(this._propertyTrack.GetPropertyName()){case "volume":return this._MaybeSetAudioSource(),
super.GetInterpolatedValue(a,d,c)}}Getter(a,d){return this._audioSource?this._audioSource.GetVolume():0}Setter(a,d,c,f){this._audioSource&&this._audioSource.SetVolume(this.Getter()+d);this._actions&&this._audioSource&&this._actions.SetVolume.call(this._sdkInstance,this._audioSource.GetAudioTag(),this._audioSource.GetVolume())}AbsoluteSetter(a,d,c){this._audioSource&&this._audioSource.SetVolume(d);this._actions&&this._audioSource&&this._actions.SetVolume.call(this._sdkInstance,this._audioSource.GetAudioTag(),
this._audioSource.GetVolume())}DoesRounding(){return!0}_SaveToJson(){return{audioPlaybackStarted:this._audioPlaybackStarted,audioTag:this._audioTag,pauseTime:this._pauseTime,pauseVolume:this._pauseVolume,volume:this._volume}}_LoadFromJson(a){a&&(this._audioPlaybackStarted=a.audioPlaybackStarted,this._audioTag=a.audioTag,this._pauseTime=a.pauseTime,this._pauseVolume=a.pauseVolume,this._volume=a.volume,this._Initialize())}}e.PropertyTrackState.AudioSourceAdapter=b}"use strict";
self.C3.PropertyTrackState.PropertyInterpolationAdapter=class{constructor(e){this._sourceAdapter=e;this._propertyTrack=e.GetPropertyTrack();this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo();this._property=this._propertyTrack.GetPropertyName();this._firstAbsoluteUpdate=!1;this._target=this._saveState=null}Release(){this._target=this._saveState=this._worldInfo=this._propertyTrack=this._sourceAdapter=null}MayNeedBeforeAndAfterInterpolate(){return!1}TimelineRemoved(){}CleanCaches(){this._target=
this._saveState=this._worldInfo=null}GetSourceAdapter(){return this._sourceAdapter}GetPropertyTrack(){return this._propertyTrack}GetWorldInfo(){return this._worldInfo?this._worldInfo:this._worldInfo=this._propertyTrack.GetTrack().GetWorldInfo()}SetFirstAbsoluteUpdate(e){this._firstAbsoluteUpdate=!!e}GetFirstAbsoluteUpdate(){return this._firstAbsoluteUpdate}SetResetState(){}SetInitialState(){}SetResumeState(){}SetSaveState(){this._saveState=this.GetCurrentState()}ClearSaveState(){this._saveState=null}GetCurrentState(){}CompareInitialStateWithCurrent(){}CompareSaveStateWithCurrent(){}CanChange(e){return typeof this._Getter()===
typeof e}BeforeChangeProperty(){}ChangeProperty(e,b,a,d,c){}AfterChangeProperty(){}_FirstKeyframeGetter(){return this._PickTimelinePlaybackMode(()=>{const e=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyframeDataItem(e)},()=>{const e=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e)}).GetAbsoluteValue()}_CurrentKeyframeGetter(){const e=this._propertyTrack.GetTimeline().GetTime()-
this._propertyTrack.GetTrack().GetStartOffset();return this._PickTimelinePlaybackMode(()=>{const b=this._propertyTrack.GetPropertyTrackDataItem();return this._propertyTrack.GetPropertyTrackData().GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(e,b)},()=>{const b=this._propertyTrack.GetPropertyTrackDataItem(),a=this._propertyTrack.GetPropertyTrackData(),d=a.GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(e,b);return d?d:a.GetLastPropertyKeyframeDataItem(b)}).GetAbsoluteValue()}_PickTimelinePlaybackMode(e,
b){return this._propertyTrack.GetTimeline().IsForwardPlayBack()?e():b()}_PickResultMode(e,b){return"relative"===this._propertyTrack.GetResultMode()?e():b()}_PickFirstAbsoluteUpdate(e,b){return this.GetFirstAbsoluteUpdate()?(this.SetFirstAbsoluteUpdate(!1),e()):b()}_GetAbsoluteInitialValue(e){}_GetIndex(){return this._sourceAdapter.GetIndex()}_GetTarget(){return this._target?this._target:this._target=this._sourceAdapter.GetTarget()}_PickSource(e,b,a,d,c,f){switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return e();
case "effect":return b();case "instance-variable":return a();case "plugin":return d();case "world-instance":return c();case "audio":return f()}}_SaveToJson(){return{firstAbsoluteUpdate:this._firstAbsoluteUpdate,saveState:this._saveState}}_LoadFromJson(e){e&&(this._firstAbsoluteUpdate=e.firstAbsoluteUpdate,this._saveState=e.saveState)}_GetPropertyKeyframeStubs(e,b=!1){const a=[];for(const d of e){e=d.GetTrack().GetStartOffset();for(const c of d.GetPropertyKeyframeDataItems())b&&0===c.GetTime()?a.push({time:e+
c.GetTime(),value:c.GetAbsoluteValue()}):b||a.push({time:e+c.GetTime(),value:c.GetAbsoluteValue()})}return a.sort((d,c)=>d.time-c.time)}_GetLastPropertyKeyframeStub(e,b,a){return this._GetPropertyKeyframeStubLowerThanPlayhead(b,a)}_GetPropertyKeyframeStubLowerThanPlayhead(e,b){for(let a=b.length-1;0<=a;a--)if(b[a].time<=e)return b[a];return null}};
{"use strict";const e=self.C3,b=new Map,a=[0,0,0];class d extends e.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c)}SetResetState(){}SetInitialState(){}SetResumeState(){}GetCurrentState(){const c=this._propertyTrack.GetSourceAdapterId(),f=this._GetTarget(),h=this._GetIndex();switch(c){case "behavior":return this._ToColorArray(f.GetPropertyValueByIndex(h));case "effect":return this._ToColorArray(f[h]);case "plugin":return this._ToColorArray(f.GetPropertyValueByIndex(h));case "world-instance":return this._ToColorArray(this._Getter())}}CompareInitialStateWithCurrent(){const c=
this._FirstKeyframeGetter();return!this._CompareColors(c,this._Getter())}CompareSaveStateWithCurrent(){return e.IsNullOrUndefined(this._saveState)?!1:!this._CompareColors(this._saveState,this._Getter())}_CompareColors(c,f){c=this._GetColorFromArray(c);f=this._GetColorFromArray(f);return c.equalsIgnoringAlpha(f)}_FirstKeyframeGetter(){const c=super._FirstKeyframeGetter();return this._GetColorFromArray(c)}_CurrentKeyframeGetter(){const c=super._CurrentKeyframeGetter();return this._GetColorFromArray(c)}_GetAbsoluteInitialValue(c){}_ToColorArray(c){return e.IsInstanceOf(c,
e.Color)?c.toArray().slice(0,3):c.slice(0,3)}_GetColorFromArray(c){return e.IsInstanceOf(c,e.Color)?c:new e.Color(c[0],c[1],c[2],1)}CanChange(c){return!0}MayNeedBeforeAndAfterInterpolate(){return!0}BeforeChangeProperty(){var c=this._propertyTrack.GetTimeline(),f=this._propertyTrack.GetInstance();const h=this._propertyTrack.GetSourceAdapter();(c=c.GetSimilarPropertyTracks(f,h,this._property))&&1<c.length&&(b.has(f)||b.set(f,new Map),f=b.get(f),c=this._propertyTrack.GetSourceAdapterId(),f.has(c)||f.set(c,
new Map),f=f.get(c),f.has(this._property)||f.set(this._property,{used:!1,color:new e.Color(0,0,0,1)}))}_GetTmpColor(c,f,h){c=b.get(c).get(f).get(h);c.used=!0;return c.color}ChangeProperty(c,f,h,g,l){l=this._propertyTrack.GetTimeline();g=this._propertyTrack.GetTrack();c=this._propertyTrack.GetInstance();var m=this._propertyTrack.GetSourceAdapter();h=this._propertyTrack.GetSourceAdapterId();if((m=l.GetSimilarPropertyTracks(c,m,this._property))&&1<m.length){if(m=this._GetPropertyKeyframeStubs(m,!0),
l=this._GetLastPropertyKeyframeStub(l,l.GetTime(),m))g=g.GetStartOffset(),m=l.time-g,0===m?this._GetTmpColor(c,h,this._property).addRgb(f[0],f[1],f[2]):0>m||(l=f[0],g=f[1],f=f[2],m=this._propertyTrack.Interpolate(m,!1,!0),l=e.Color.DiffChannel(l,m[0]),g=e.Color.DiffChannel(g,m[1]),f=e.Color.DiffChannel(f,m[2]),this._GetTmpColor(c,h,this._property).addRgb(l,g,f))}else this._Setter(f[0],f[1],f[2])}AfterChangeProperty(){const c=this._propertyTrack.GetInstance();if(b.has(c)){var f=b.get(c),h=this._propertyTrack.GetSourceAdapterId();
if(f.has(h)){var g=f.get(h);if(g.has(this._property)){var l=g.get(this._property),m=l.color;l.used&&this._Setter(m.getR(),m.getG(),m.getB());0===g.size&&f.delete(h);0===f.size&&b.delete(c)}}}}_Getter(){const c=this._propertyTrack.GetSourceAdapterId(),f=this._GetTarget(),h=this._GetIndex();switch(c){case "behavior":return this._GetColorFromArray(f.GetPropertyValueByIndex(h));case "effect":return f[h].clone();case "plugin":return this._GetColorFromArray(f.GetPropertyValueByIndex(h));case "world-instance":return this.GetWorldInfo().GetUnpremultipliedColor().clone()}}_Setter(c,
f,h){const g=this._propertyTrack.GetSourceAdapterId(),l=this._GetTarget(),m=this._GetIndex();switch(g){case "behavior":a[0]=c;a[1]=f;a[2]=h;l.SetPropertyValueByIndex(m,a);break;case "effect":l[m].setRgb(c,f,h);break;case "plugin":a[0]=c;a[1]=f;a[2]=h;l.SetPropertyValueByIndex(m,a);break;case "world-instance":this.GetWorldInfo().SetUnpremultipliedColorRGB(c,f,h)}}_SaveToJson(){}_LoadFromJson(c){}}e.PropertyTrackState.PropertyInterpolationAdapter.ColorInterpolationAdapter=d}
{"use strict";const e=self.C3,b=e.PropertyTrackState;class a extends e.PropertyTrackState.PropertyInterpolationAdapter{constructor(d){super(d)}SetResetState(){}SetInitialState(){}SetResumeState(){}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return e.IsNullOrUndefined(this._saveState)?!1:this._saveState!==this.GetCurrentState()}MayNeedBeforeAndAfterInterpolate(){return!1}ChangeProperty(d,
c,f,h,g){f=this._propertyTrack;const l=f.GetTrack();h=f.GetSourceAdapterId();g=f.GetTimeline();var m=l.GetInstance();const u=f.GetSourceAdapter();(m=g.GetSimilarPropertyTracks(m,u,this._property))&&1<m.length&&(m=this._GetPropertyKeyframeStubs(m),d+=l.GetStartOffset(),d=this._GetLastPropertyKeyframeStub(g,d,m))&&(c=d.value);switch(f.GetPropertyKeyframeType()){case "numeric":if(!b.NumericTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),c,h))return;break;case "angle":if(!b.AngleTypeAdapter.WillChange(this._GetIndex(),
this._GetTarget(),c,h))return;break;case "boolean":if(!b.BooleanTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),c,h))return;break;case "color":if(!b.ColorTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),c,h))return;break;case "text":if(!b.TextTypeAdapter.WillChange(this._GetIndex(),this._GetTarget(),c,h))return}this._Setter(c)}_Getter(){const d=this._propertyTrack.GetSourceAdapterId(),c=this._GetTarget(),f=this._GetIndex();switch(d){case "behavior":return c.GetPropertyValueByIndex(f);
case "effect":return c[f];case "instance-variable":return c.GetInstanceVariableValue(f);case "plugin":return c.GetPropertyValueByIndex(f)}}_Setter(d){const c=this._propertyTrack.GetSourceAdapterId(),f=this._GetTarget(),h=this._GetIndex();switch(c){case "behavior":f.SetPropertyValueByIndex(h,d);break;case "effect":f[h]=d;break;case "instance-variable":f.SetInstanceVariableValue(h,d);break;case "plugin":f.SetPropertyValueByIndex(h,d)}}}e.PropertyTrackState.PropertyInterpolationAdapter.NoInterpolationAdapter=
a}
{"use strict";const e=self.C3,b=new Map,a=(c,f,h,g,l,m=!1,u=null,w=null)=>{b.set(c,{setter:f,absolute_setter:h,getter:g,round:l,fRound:m,init:u,reset:w})};a("offsetX",(c,f)=>c.OffsetX(f),(c,f)=>c.SetX(f),c=>c.GetX(),!0);a("offsetY",(c,f)=>c.OffsetY(f),(c,f)=>c.SetY(f),c=>c.GetY(),!0);a("offsetWidth",(c,f)=>c.OffsetWidth(f),(c,f)=>c.SetWidth(f),c=>c.GetWidth(),!0);a("offsetHeight",(c,f)=>c.OffsetHeight(f),(c,f)=>c.SetHeight(f),c=>c.GetHeight(),!0);a("offsetAngle",(c,f)=>c.OffsetAngle(f),(c,f)=>c.SetAngle(f),c=>
c.GetAngle(),!1);a("offsetOpacity",(c,f,h,g)=>{h=c.GetOpacity()+f;0===g._clampAccumulator?(1<h?g._clampAccumulator+=h-1:0>h&&(g._clampAccumulator+=h),c.OffsetOpacity(f)):(c=c.GetOpacity()+f,0<f&&0<g._clampAccumulator?1<c&&(g._clampAccumulator+=c-1):0<f&&0>g._clampAccumulator?(g._clampAccumulator+=f,0<g._clampAccumulator&&(g._clampAccumulator=0)):0>f&&0<g._clampAccumulator?(g._clampAccumulator+=f,0>g._clampAccumulator&&(g._clampAccumulator=0)):0>f&&0>g._clampAccumulator&&0>c&&(g._clampAccumulator+=
c))},(c,f)=>{c.SetOpacity(f)},c=>c.GetOpacity(),!1,!0,c=>{c._clampAccumulator=0;switch(c._propertyTrack.GetResultMode()){case "relative":{c._propertyTrack.GetPropertyTrackData();const l=c._propertyTrack.GetPropertyTrackDataItem().GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();var f=c.GetWorldInfo().GetOpacity(),h=f;for(var g of l)h=g.GetTime(),h=c._propertyTrack.GetInterpolatedValue(h),h=f+h,h=e.clamp(h,0,1);c._totalForewardOpacityDelta=f-h;c._totalForewardOpacityDelta=Math.round(100*
(c._totalForewardOpacityDelta+Number.EPSILON))/100;h=f;for(f=l.length-1;0<=f;f--)g=l[f].GetTime(),g=c._propertyTrack.GetInterpolatedValue(g),h-=g,h=e.clamp(h,0,1);c._totalBackwardOpacityDelta=h;c._totalBackwardOpacityDelta=Math.round(100*(c._totalBackwardOpacityDelta+Number.EPSILON))/100}}},c=>{switch(c._propertyTrack.GetResultMode()){case "relative":{c._clampAccumulator=0;const f=c.GetWorldInfo();let h=f.GetOpacity();h=Math.round(100*(h+Number.EPSILON))/100;c._propertyTrack.GetTimeline().IsForwardPlayBack()?
(f.SetOpacity(h+c._totalForewardOpacityDelta),c._lastValue=0):(f.SetOpacity(h-c._totalBackwardOpacityDelta),c._lastValue=c.GetSourceAdapter().GetValueAtTime())}}});a("offsetOriginX",(c,f)=>c.OffsetOriginX(f),(c,f)=>c.SetOriginX(f),c=>c.GetOriginX(),!1);a("offsetOriginY",(c,f)=>c.OffsetOriginY(f),(c,f)=>c.SetOriginY(f),c=>c.GetOriginY(),!1);a("offsetZElevation",(c,f)=>c.OffsetZElevation(f),(c,f)=>c.SetZElevation(f),c=>c.GetZElevation(),!0);a("offsetScaleX",(c,f,h,g)=>{g=0>c.GetWidth()?-1:1;c.GetTransformWithParentWidth();
c.OffsetWidth(h.GetOriginalWidth()*g*f)},(c,f,h)=>{c.SetWidth(h.GetOriginalWidth()*f)},(c,f)=>{const h=0>c.GetWidth()?-1:1;if(c.GetTransformWithParentWidth()){var g=c.GetParent(),l=f.GetTimeline().GetTrackFromInstance(g.GetInstance());l?g=g.GetWidth()/l.GetOriginalWidth():(l=g.GetInstance().GetSdkInstance(),g=l.IsOriginalSizeKnown()?g.GetWidth()/l.GetOriginalWidth():1);return c.GetWidth()*h/(f.GetOriginalWidth()*g)}return c.GetWidth()*h/f.GetOriginalWidth()},!1);a("offsetScaleY",(c,f,h,g)=>{g=0>c.GetHeight()?
-1:1;c.GetTransformWithParentHeight();c.OffsetHeight(h.GetOriginalHeight()*g*f)},(c,f,h)=>{c.SetHeight(h.GetOriginalHeight()*f)},(c,f)=>{const h=0>c.GetHeight()?-1:1;if(c.GetTransformWithParentHeight()){var g=c.GetParent(),l=f.GetTimeline().GetTrackFromInstance(g.GetInstance());l?g=g.GetHeight()/l.GetOriginalHeight():(l=g.GetInstance().GetSdkInstance(),g=l.IsOriginalSizeKnown()?g.GetHeight()/l.GetOriginalHeight():1);return c.GetHeight()*h/(f.GetOriginalHeight()*g)}return c.GetHeight()*h/f.GetOriginalHeight()},
!1);class d extends e.PropertyTrackState.PropertyInterpolationAdapter{constructor(c){super(c);this._totalBackwardOpacityDelta=this._totalForewardOpacityDelta=this._clampAccumulator=this._lastValue=0;this._source_adapter_absolute_setter=this._source_adapter_setter=this._source_adapter_getter=this._init_action=this._reset_action=this._instance_absolute_setter=this._instance_setter=this._instance_getter=null;this._fRound=this._round=!1;e.IsInstanceOf(this._propertyTrack.GetTimeline(),e.TweenState)?this._typeAdapter=
new e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween(this):this._typeAdapter=new e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline(this);const f=this._propertyTrack.GetPropertyName();switch(this._propertyTrack.GetSourceAdapterId()){case "world-instance":c=b.get(f);this._instance_getter=c.getter;this._instance_setter=c.setter;this._instance_absolute_setter=c.absolute_setter;this._round=c.round;this._fRound=c.fRound;this._init_action=
c.init;this._reset_action=c.reset;break;case "audio":this._source_adapter_getter=c.Getter,this._source_adapter_setter=c.Setter,this._source_adapter_absolute_setter=c.AbsoluteSetter,this._round=!!c.DoesRounding(),this._fRound=!1}}Release(){this._instance_absolute_setter=this._instance_setter=this._instance_getter=this._typeAdapter=null;super.Release()}MayNeedBeforeAndAfterInterpolate(){return this._typeAdapter.MayNeedBeforeAndAfterInterpolate()}GetLastValue(){return this._lastValue}SetLastValue(c){this._lastValue=
c}SetResetState(){this._reset_action&&this._reset_action(this)}SetInitialState(){const c=this._typeAdapter.SetInitialState();"number"===typeof c&&(this._lastValue=c);this._init_action&&this._init_action(this)}SetResumeState(){const c=this._typeAdapter.SetResumeState();"number"===typeof c&&(this._lastValue=c)}GetCurrentState(){return this._Getter()}CompareInitialStateWithCurrent(){return this._FirstKeyframeGetter()!==this.GetCurrentState()}CompareSaveStateWithCurrent(){return e.IsNullOrUndefined(this._saveState)?
!1:this._saveState!==this.GetCurrentState()}BeforeChangeProperty(){this._typeAdapter.BeforeChangeProperty()}ChangeProperty(c,f,h,g,l,m,u){return this._typeAdapter.ChangeProperty(c,f,h,g,l,m,u)}AfterChangeProperty(){this._typeAdapter.AfterChangeProperty()}_Getter(){const c=this._GetTarget(),f=this._GetIndex(),h=this.GetWorldInfo(),g=this._propertyTrack.GetTrack();switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":return c.GetPropertyValueByIndex(f);case "effect":return c[f];case "instance-variable":return c.GetInstanceVariableValue(f);
case "plugin":return c.GetPropertyValueByIndex(f);case "world-instance":return this._instance_getter(h,g);case "audio":return this._source_adapter_getter.call(this.GetSourceAdapter(),h,g)}}_Setter(c,f,h){f=this._GetTarget();h=this._GetIndex();const g=this.GetWorldInfo(),l=this._propertyTrack.GetTrack();switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":f.OffsetPropertyValueByIndex(h,c);break;case "effect":f[h]+=c;break;case "instance-variable":f.SetInstanceVariableOffset(h,c);break;
case "plugin":f.OffsetPropertyValueByIndex(h,c);break;case "world-instance":this._instance_setter(g,c,l,this);break;case "audio":this._source_adapter_setter.call(this.GetSourceAdapter(),g,c,l,this)}}_SetterAbsolute(c,f,h){f=this._GetTarget();h=this._GetIndex();const g=this.GetWorldInfo(),l=this._propertyTrack.GetTrack();switch(this._propertyTrack.GetSourceAdapterId()){case "behavior":f.SetPropertyValueByIndex(h,c);break;case "effect":f[h]=c;break;case "instance-variable":f.SetInstanceVariableValue(h,
c);break;case "plugin":f.SetPropertyValueByIndex(h,c);break;case "world-instance":this._instance_absolute_setter(g,c,l);break;case "audio":this._source_adapter_absolute_setter.call(this.GetSourceAdapter(),g,c,l)}}_MaybeEnsureValue(c,f,h,g,l,m){this._typeAdapter._MaybeEnsureValue(c,f,h,g,l,m)}_AddDelta(c,f,h){var g=(c.toString().split(".")[1]||"").length;c=this._Getter();g=0===g?this._round?Math.round(c):this._fRound?Math.round(100*(c+Number.EPSILON))/100:c:e.toFixed(c,g);this._Setter(g-c,f,h)}_SaveToJson(){return Object.assign(super._SaveToJson(),
{v:this._lastValue,a:this._clampAccumulator,fod:this._totalForewardOpacityDelta,bod:this._totalBackwardOpacityDelta})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._lastValue=c.v,this._clampAccumulator=c.a,this._totalForewardOpacityDelta=e.IsFiniteNumber(c.fod)?c.fod:0,this._totalBackwardOpacityDelta=e.IsFiniteNumber(c.bod)?c.bod:0)}}e.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapter=d}
{"use strict";class e{constructor(a){this._used=!1;this._value=0;this._propertyTracks=a;for(let d=0,c=this._propertyTracks.length;d<c;d++)this._propertyTracks[d].SetAbsoluteValueObject(this)}GetPropertyTracks(){return this._propertyTracks}SetUsed(){this._used=!0}GetUsed(){return this._used}SetValue(a){this._value=a}GetValue(){return this._value}Reset(){this._used=!1;this._value=0}}class b{constructor(a){this._numericInterpolationAdapter=a}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const a=
this._numericInterpolationAdapter;this._numericInterpolationAdapter.GetPropertyTrack();return a._PickResultMode(()=>a._PickTimelinePlaybackMode(()=>0,()=>a.GetSourceAdapter().GetValueAtTime()),()=>{})}SetResumeState(){}MayNeedBeforeAndAfterInterpolate(){switch(this._numericInterpolationAdapter.GetPropertyTrack().GetResultMode()){case "relative":return!1;case "absolute":return!0}}BeforeChangeProperty(){var a=this._numericInterpolationAdapter.GetPropertyTrack(),d=a.GetPropertyName();switch(a.GetResultMode()){case "absolute":if(a.HasAbsoluteValueObject())a.GetAbsoluteValueObject().Reset();
else{const c=a.GetTimeline(),f=a.GetInstance();a=a.GetSourceAdapter();(d=c.GetSimilarPropertyTracks(f,a,d))&&1<d.length&&new e(d)}}}ChangeProperty(a,d,c,f,h,g){var l=this._numericInterpolationAdapter,m=this._numericInterpolationAdapter.GetPropertyTrack();switch(m.GetResultMode()){case "relative":m=l.GetLastValue();l._Setter(d-m,c,f);g&&this._MaybeEnsureValue(a,c,f,h,m,d);l.SetLastValue(d);break;case "absolute":if(f=m.GetTimeline(),c=m.GetTrack(),m.GetInstance(),m.GetSourceAdapter(),m.HasAbsoluteValueObject()){if(a=
m.GetAbsoluteValueObject(),h=a.GetPropertyTracks(),h=l._GetPropertyKeyframeStubs(h,!0),l=l._GetLastPropertyKeyframeStub(f,f.GetTime(),h))c=c.GetStartOffset(),l=l.time-c,0===l?(a.SetUsed(),a.SetValue(a.GetValue()+d)):0>l||(m=m.GetInterpolatedValue(l),a.SetUsed(),a.SetValue(a.GetValue()+(d-m)))}else l._SetterAbsolute(d)}}AfterChangeProperty(){const a=this._numericInterpolationAdapter;var d=this._numericInterpolationAdapter.GetPropertyTrack();switch(d.GetResultMode()){case "absolute":d.HasAbsoluteValueObject()&&
(d=d.GetAbsoluteValueObject(),d.GetUsed()&&a._SetterAbsolute(d.GetValue()))}}_MaybeEnsureValue(a,d,c,f,h,g){const l=this._numericInterpolationAdapter;f||(d&&a===d.GetTime()?l._AddDelta(d.GetValueWithResultMode(),d,c):c&&a===c.GetTime()?l._AddDelta(c.GetValueWithResultMode(),d,c):0===g-h&&l._AddDelta(d.GetValueWithResultMode(),d,c))}}self.C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTimeline=b}
{"use strict";class e{constructor(b){this._numericInterpolationAdapter=b}Release(){this._numericInterpolationAdapter=null}SetInitialState(){const b=this._numericInterpolationAdapter;b.SetFirstAbsoluteUpdate(!0);return this._GetAbsoluteInitialValue(b._FirstKeyframeGetter())}SetResumeState(){const b=this._numericInterpolationAdapter;if(b._FirstKeyframeGetter()!==b._CurrentKeyframeGetter())return b.SetFirstAbsoluteUpdate(!0),this._GetAbsoluteInitialValue(b._CurrentKeyframeGetter())}MayNeedBeforeAndAfterInterpolate(){return!1}BeforeChangeProperty(){}ChangeProperty(b,
a,d,c,f,h){const g=this._numericInterpolationAdapter,l=g.GetLastValue();switch(g.GetPropertyTrack().GetResultMode()){case "relative":g._Setter(a-l,d,c);h&&this._MaybeEnsureValue(b,d,c,f,l,a);break;case "absolute":g.GetFirstAbsoluteUpdate()?(g.SetFirstAbsoluteUpdate(!1),g._Setter(l,d,c)):(g._Setter(a-l,d,c),h&&this._MaybeEnsureValue(b,d,c,f,l,a))}g.SetLastValue(a)}AfterChangeProperty(){}_GetAbsoluteInitialValue(b){return b-this._numericInterpolationAdapter.GetCurrentState()}_MaybeEnsureValue(b,a,d,
c,f,h){const g=this._numericInterpolationAdapter;c?a&&b===a.GetTime()?g._AddDelta(a.GetValueWithResultMode(),a,d):d&&b===d.GetTime()?g._AddDelta(d.GetValueWithResultMode(),a,d):d||g._AddDelta(a.GetValueWithResultMode(),a,d):a&&b===a.GetTime()?g._AddDelta(a.GetValueWithResultMode(),a,d):d&&b===d.GetTime()?g._AddDelta(d.GetValueWithResultMode(),a,d):0===h-f&&g._AddDelta(a.GetValueWithResultMode(),a,d)}}self.C3.PropertyTrackState.PropertyInterpolationAdapter.NumericInterpolationAdapterForTween=e}
{"use strict";const e=self.C3,b=self.Ease;e.PropertyTrackState.NumericTypeAdapter=class{constructor(){}static WillChange(a,d,c,f){let h;switch(f){case "behavior":h=d.GetPropertyValueByIndex(a);break;case "effect":h=d[a];break;case "instance-variable":h=d.GetInstanceVariableValue(a);break;case "plugin":h=d.GetPropertyValueByIndex(a)}return h===c?!1:!0}static Interpolate(a,d,c,f){if(!c)return c=f.GetPropertyTrackDataItem(),c=f.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(c),c.GetValueWithResultMode();
var h=f.GetInterpolationMode();"default"===h&&(h="continuous");"combo"===f.GetPropertyType()&&(h="discrete");if("discrete"===h)return d.GetValueWithResultMode();if("continuous"===h||"step"===h){"step"===h&&(h=f.GetTimeline().GetStep(),0!==h&&(h=1/h,a=Math.floor(a*h)/h));var g=d.GetTime();const l=c.GetTime();h=d.GetValueWithResultMode();const m=c.GetValueWithResultMode();if(h===m)return h;a=e.normalize(a,g,l);const u=d.GetEase();d=d.GetAddOn("cubic-bezier");c=c.GetAddOn("cubic-bezier");d&&d.GetStartEnable()&&
c&&c.GetEndEnable()?(g=l-g,g=b.GetRuntimeEase(u)(g*a,0,1,g),g=b.GetRuntimeEase("cubicbezier")(g,h,h+d.GetStartAnchor(),m+c.GetEndAnchor(),m)):g=b.GetRuntimeEase(u)((l-g)*a,h,m-h,l-g);return"integer"===f.GetPropertyType()?Math.floor(g):g}}}}
{"use strict";const e=self.C3;e.PropertyTrackState.AngleTypeAdapter=class{constructor(){}static WillChange(b,a,d,c){let f;switch(c){case "behavior":f=a.GetPropertyValueByIndex(b);break;case "effect":f=a[b];break;case "instance-variable":f=a.GetInstanceVariableValue(b);break;case "plugin":f=a.GetPropertyValueByIndex(b)}return f===d?!1:!0}static Interpolate(b,a,d,c){if(!d)return a=c.GetPropertyTrackDataItem(),a=c.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(a),a.GetValueWithResultMode();var f=
c.GetInterpolationMode();"default"===f&&(f="continuous");"combo"===c.GetPropertyType()&&(f="discrete");if("discrete"===f)return a.GetValueWithResultMode();if("continuous"===f||"step"===f){"step"===f&&(c=c.GetTimeline().GetStep(),0!==c&&(c=1/c,b=Math.floor(b*c)/c));const h=a.GetTime(),g=d.GetTime();c=a.GetValueWithResultMode();d=d.GetValueWithResultMode();if(f=a.GetAddOn("angle")){const l=f.GetRevolutions();if(c===d&&0===l)return c;b=e.normalize(b,h,g);a=self.Ease.GetRuntimeEase(a.GetEase())(b,0,1,
1);switch(f.GetDirection()){case "closest":return e.angleLerp(c,d,a,l);case "clockwise":return e.angleLerpClockwise(c,d,a,l);case "anti-clockwise":return e.angleLerpAntiClockwise(c,d,a,l)}}else{if(c===d)return c;b=e.normalize(b,h,g);a=self.Ease.GetRuntimeEase(a.GetEase());return e.angleLerp(c,d,a(b,0,1,1))}}}}}"use strict";
self.C3.PropertyTrackState.BooleanTypeAdapter=class{constructor(){}static WillChange(e,b,a,d){let c;switch(d){case "behavior":c=b.GetPropertyValueByIndex(e);break;case "effect":c=b[e];break;case "instance-variable":c=b.GetInstanceVariableValue(e);break;case "plugin":c=b.GetPropertyValueByIndex(e)}return!!c===!!a?!1:!0}static Interpolate(e,b,a,d){return a?b.GetValueWithResultMode()?1:0:(e=d.GetPropertyTrackDataItem(),e=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e),e.GetValueWithResultMode()?
1:0)}};
{"use strict";const e=self.C3,b=[0,0,0],a=[0,0,0],d=[0,0,0];e.PropertyTrackState.ColorTypeAdapter=class{constructor(){}static WillChange(c,f,h,g){let l;switch(g){case "behavior":l=f.GetPropertyValueByIndex(c);break;case "effect":l=f[c];break;case "instance-variable":l=f.GetInstanceVariableValue(c);break;case "plugin":l=f.GetPropertyValueByIndex(c)}Array.isArray(h)?(b[0]=h[0],b[1]=h[1],b[2]=h[2]):(d.parseCommaSeparatedRgb(h),b[0]=Math.floor(255*d.getR()),b[1]=Math.floor(255*d.getG()),b[2]=Math.floor(255*d.getB()));
Array.isArray(l)?(a[0]=l[0],a[1]=l[1],a[2]=l[2]):(d.parseCommaSeparatedRgb(l),a[0]=Math.floor(255*d.getR()),a[1]=Math.floor(255*d.getG()),a[2]=Math.floor(255*d.getB()));return b[0]!==a[0]||b[1]!==a[1]||b[2]!==a[2]?!0:!1}static Interpolate(c,f,h,g){if(!h){var l=g.GetPropertyTrackDataItem();l=g.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(l);g=l.GetValueWithResultMode();b[0]=g[0];b[1]=g[1];b[2]=g[2];return b}l=g.GetInterpolationMode();"default"===l&&(l="continuous");if("discrete"===l)return g=
f.GetValueWithResultMode(),b[0]=g[0],b[1]=g[1],b[2]=g[2],b;if("continuous"===l||"step"===l){"step"===l&&(g=g.GetTimeline().GetStep(),0!==g&&(g=1/g,c=Math.floor(c*g)/g));g=f.GetTime();l=h.GetTime();var m=f.GetValueWithResultMode(),u=h.GetValueWithResultMode();c=e.normalize(c,g,l);var w=f.GetEase();f=m[0];h=m[1];m=m[2];const q=u[0],t=u[1];u=u[2];w=self.Ease.GetRuntimeEase(w);g=l-g;l=g*c;b[0]=f===q?f:w(l,f,q-f,g);b[1]=h===t?h:w(l,h,t-h,g);b[2]=m===u?m:w(l,m,u-m,g);return b}}}}"use strict";
self.C3.PropertyTrackState.TextTypeAdapter=class{constructor(){}static WillChange(e,b,a,d){let c;switch(d){case "behavior":c=b.GetPropertyValueByIndex(e);break;case "effect":c=b[e];break;case "instance-variable":c=b.GetInstanceVariableValue(e);break;case "plugin":c=b.GetPropertyValueByIndex(e)}return c===a?!1:!0}static Interpolate(e,b,a,d){return a?b.GetValueWithResultMode():(e=d.GetPropertyTrackDataItem(),e=d.GetPropertyTrackData().GetLastPropertyKeyframeDataItem(e),e.GetValueWithResultMode())}};
{"use strict";const e=self.C3;e.TimelineDataManager=class{constructor(){this._timelineDataItems=new Map}Release(){for(const b of this._timelineDataItems.values())b.Release();this._timelineDataItems.clear();this._timelineDataItems=null}Add(b){b=new e.TimelineDataItem(b);const a=b.GetName();this._timelineDataItems.set(a,b)}Get(b){return this._timelineDataItems.get(b)}GetNameId(){return 0}static _CreateDataItems(b,a,d,c){if(a)for(const f of a)e.TimelineDataManager._CreateDataItem("create",f,b,d,c)}static _LoadDataItemsFromJson(b,
a,d,c){b.length?a.forEach((f,h)=>{b[h]._LoadFromJson(f)}):a.forEach(f=>{e.TimelineDataManager._CreateDataItem("load",f,b,d,c)})}static _CreateDataItem(b,a,d,c,f){let h;if("function"===typeof c)switch(b){case "load":h=new c(null,f);break;case "create":h=new c(a,f)}else if("object"===typeof c)switch(c=c.map.get(a[c.prop]),b){case "load":h=new c(null,f);break;case "create":h=new c(a,f)}switch(b){case "load":h._LoadFromJson(a);d.push(h);break;case "create":if("function"===typeof h.GetEnable&&!h.GetEnable())return h.Release();
d.push(h)}}}}
{"use strict";const e=self.C3;e.TimelineDataItem=class{constructor(b){this._name="";this._totalTime=NaN;this._step=0;this._resultMode=this._interpolationMode="default";this._pingPong=this._loop=!1;this._repeatCount=1;this._trackData=null;b&&(this._name=b[0],this._totalTime=b[1],this._step=b[2],this._interpolationMode=b[3],this._resultMode=b[4],this._loop=!!b[6],this._pingPong=!!b[7],this._repeatCount=b[8],this._trackData=new e.TrackData(b[5],this))}Release(){this._trackData.Release();this._trackData=
null}GetTrackData(){this._trackData||(this._trackData=new e.TrackData(null,this));return this._trackData}GetName(){return this._name}SetName(b){this._name=b}GetTotalTime(){return this._totalTime}SetTotalTime(b){this._totalTime=b}GetStep(){return this._step}SetStep(b){this._step=b}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(b){this._interpolationMode=b}GetResultMode(){return this._resultMode}SetResultMode(b){this._resultMode=b}GetLoop(){return this._loop}SetLoop(b){this._loop=
b}GetPingPong(){return this._pingPong}SetPingPong(b){this._pingPong=b}GetRepeatCount(){return this._repeatCount}_SaveToJson(){return{trackDataJson:this._trackData._SaveToJson(),name:this._name,totalTime:this._totalTime,step:this._step,interpolationMode:this._interpolationMode,resultMode:this._resultMode,loop:this._loop,pingPong:this._pingPong,repeatCount:this._repeatCount}}_LoadFromJson(b){b&&(this.GetTrackData()._LoadFromJson(b.trackDataJson),this._name=b.name,this._totalTime=b.totalTime,this._step=
b.step,this._interpolationMode=b.interpolationMode,this._resultMode=b.resultMode,this._loop=b.loop,this._pingPong=b.pingPong,this._repeatCount=b.repeatCount)}}}
{"use strict";const e=self.C3;class b{constructor(a,d){this._trackData=d;this._additionalInstanceData=this._instanceData=null;this._objectClassIndex=this._instanceUid=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyTrackData=this._keyframeData=null;this._id="";this._nestedData=null;this._startOffset=0;this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime();this._type=0;this._name="";a&&(a[0]&&(this._instanceData=a[0],this._instanceUid=a[0][2],
this._objectClassIndex=a[0][1]),this._interpolationMode=a[1],this._resultMode=a[2],this._enabled=!!a[3],a[6]&&(this._id=a[6]),a[7]&&(this._nestedData=a[7],this._startOffset=a[7][0],this._localTotalTime=a[7][1]),a[8]&&(this._additionalInstanceData=a[8]),a[8]&&(this._additionalInstanceData=a[8]),a[9]&&(this._type=a[9]),a[10]&&(this._name=a[10]),this._keyframeData=new e.KeyframeData(a[4],this),this._propertyTrackData=new e.PropertyTrackData(a[5],this))}Release(){this._trackData=this._instanceData=null;
this._keyframeData&&(this._keyframeData.Release(),this._keyframeData=null);this._propertyTrackData&&(this._propertyTrackData.Release(),this._propertyTrackData=null);this._nestedData=null}GetTrackData(){return this._trackData}GetKeyframeData(){this._keyframeData||(this._keyframeData=new e.KeyframeData(null,this));return this._keyframeData}GetPropertyTrackData(){this._propertyTrackData||(this._propertyTrackData=new e.PropertyTrackData(null,this));return this._propertyTrackData}GetInstanceData(){return this._instanceData}GetObjectClassIndex(){return this._objectClassIndex}SetObjectClassIndex(a){this._objectClassIndex=
a}GetInstanceUID(){return this._instanceUid}SetInstanceUID(a){this._instanceUid=a}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(a){this._interpolationMode=a}GetResultMode(){return this._resultMode}SetResultMode(a){this._resultMode=a}GetEnable(){return this._enabled}SetEnable(a){this._enabled=!!a}GetId(){return this._id}GetStartOffset(){return this._startOffset}GetLocalTotalTime(){return this._localTotalTime}SetLocalTotalTime(a){this._localTotalTime=a}GetOriginalWidth(){return this._additionalInstanceData[0]}SetOriginalWidth(a){this._additionalInstanceData||
(this._additionalInstanceData=[]);this._additionalInstanceData[0]=a}GetOriginalHeight(){this._additionalInstanceData||(this._additionalInstanceData=[]);return this._additionalInstanceData[1]}SetOriginalHeight(a){this._additionalInstanceData||(this._additionalInstanceData=[]);this._additionalInstanceData[1]=a}GetType(){return this._type}GetName(){return this._name}_SaveToJson(){return{keyframeDataJson:this._keyframeData._SaveToJson(),propertyTrackDataJson:this._propertyTrackData._SaveToJson(),instanceData:this._instanceData,
additionalInstanceData:this._additionalInstanceData,instanceUid:this._instanceUid,objectClassIndex:this._objectClassIndex,interpolationMode:this._interpolationMode,resultMode:this._resultMode,enabled:this._enabled,id:this._id,nestedData:this._nestedData,type:this._type,name:this._name}}_LoadFromJson(a){a&&(this._instanceData=a.instanceData,this._instanceUid=a.instanceUid,this._objectClassIndex=a.objectClassIndex,this._interpolationMode=a.interpolationMode,this._resultMode=a.resultMode,this._enabled=
a.enabled,this._id=a.id,this._type=a.type?a.type:0,this._name=a.name?a.name:"",this._localTotalTime=this._trackData.GetTimelineDataItem().GetTotalTime(),a.nestedData&&(this._nestedData=a.nestedData,this._startOffset=this._nestedData[0],this._localTotalTime=this._nestedData[1]),a.additionalInstanceData&&(this._additionalInstanceData=a.additionalInstanceData),this.GetKeyframeData()._LoadFromJson(a.keyframeDataJson),this.GetPropertyTrackData()._LoadFromJson(a.propertyTrackDataJson))}}e.TrackData=class{constructor(a,
d){this._timelineDataItem=d;this._trackDataItems=[];e.TimelineDataManager._CreateDataItems(this._trackDataItems,a,b,this)}Release(){this._timelineDataItem=null;for(const a of this._trackDataItems)a.Release();e.clearArray(this._trackDataItems);this._trackDataItems=null}GetTimelineDataItem(){return this._timelineDataItem}AddEmptyTrackDataItem(){const a=new b(null,this);this._trackDataItems.push(a);return a}GetFirstKeyframeDataItem(a){return a.GetKeyframeData().GetKeyframeDataItemArray()[0]}GetLastKeyframeDataItem(a){return a.GetKeyframeData().GetKeyframeDataItemArray().at(-1)}GetKeyFrameDataItemAtTime(a,
d){d=d.GetKeyframeData().GetKeyframeDataItemArray();const c=d.length;for(let f=0;f<c;f++){const h=d[f];if(h.GetTime()===a)return h}}GetFirstKeyFrameDataItemHigherThan(a,d){d=d.GetKeyframeData().GetKeyframeDataItemArray();const c=d.length;for(let f=0;f<c;f++){const h=d[f];if(h.GetTime()>a)return h}}GetFirstKeyFrameDataItemHigherOrEqualThan(a,d){d=d.GetKeyframeData().GetKeyframeDataItemArray();const c=d.length;for(let f=0;f<c;f++){const h=d[f];if(h.GetTime()>=a)return h}}GetFirstKeyFrameDataItemLowerOrEqualThan(a,
d){d=d.GetKeyframeData().GetKeyframeDataItemArray();for(let c=d.length-1;0<=c;c--){const f=d[c];if(f.GetTime()<=a)return f}}*trackDataItems(){for(const a of this._trackDataItems)yield a}_SaveToJson(){return{trackDataItemsJson:this._trackDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&e.TimelineDataManager._LoadDataItemsFromJson(this._trackDataItems,a.trackDataItemsJson,b,this)}}}
{"use strict";const e=self.C3;class b{constructor(a,d){this._propertyTrackData=d;this._sourceAdapterId="";this._type=this._property=this._sourceAdapterArguments=null;this._max=this._min=NaN;this._resultMode=this._interpolationMode="default";this._enabled=!1;this._propertyKeyframeData=null;this._canHavePropertyKeyframes=!0;a&&(this._sourceAdapterId=a[0][0],this._sourceAdapterArguments=a[0].slice(1),this._property=a[1],this._type=a[2],this._min=a[3],this._max=a[4],this._interpolationMode=a[5],this._resultMode=
a[6],this._enabled=!!a[7],this._propertyKeyframeData=new e.PropertyKeyframeData(a[8],this),this._canHavePropertyKeyframes=a[9])}Release(){this._propertyKeyframeData.Release();this._sourceAdapterArguments=this._propertyTrackData=this._propertyKeyframeData=null}GetPropertyTrackData(){return this._propertyTrackData}GetPropertyKeyframeData(){this._propertyKeyframeData||(this._propertyKeyframeData=new e.PropertyKeyframeData(null,this));return this._propertyKeyframeData}GetSourceAdapterId(){return this._sourceAdapterId}SetSourceAdapterId(a){this._sourceAdapterId=
a}GetSourceAdapterArguments(){return this._sourceAdapterArguments}SetSourceAdapterArguments(a){this._sourceAdapterArguments=a}GetProperty(){return this._property}SetProperty(a){this._property=a}GetType(){return this._type}SetType(a){this._type=a}GetMin(){return this._min}SetMin(a){this._min=a}GetMax(){return this._max}SetMax(a){this._max=a}GetInterpolationMode(){return this._interpolationMode}SetInterpolationMode(a){this._interpolationMode=a}GetResultMode(){return this._resultMode}SetResultMode(a){this._resultMode=
a}GetEnable(){return this._enabled}SetEnable(a){this._enabled=!!a}CanHavePropertyKeyframes(){return!!this._canHavePropertyKeyframes}_SaveToJson(){return{propertyKeyframeDataJson:this._propertyKeyframeData._SaveToJson(),sourceAdapterId:this._sourceAdapterId,sourceAdapterArguments:this._sourceAdapterArguments,property:this._property,type:this._type,min:this._min,max:this._max,interpolationMode:this._interpolationMode,resultMode:this._resultMode,enabled:this._enabled,canHavePropertyKeyframes:this._canHavePropertyKeyframes}}_LoadFromJson(a){a&&
(this._sourceAdapterId=a.sourceAdapterId,this._sourceAdapterArguments=a.sourceAdapterArguments,this._property=a.property,this._type=a.type,this._min=a.min,this._max=a.max,this._interpolationMode=a.interpolationMode,this._resultMode=a.resultMode,this._enabled=a.enabled,this._canHavePropertyKeyframes=a.canHavePropertyKeyframes,this.GetPropertyKeyframeData()._LoadFromJson(a.propertyKeyframeDataJson))}}e.PropertyTrackData=class{constructor(a,d){this._trackDataItem=d;this._propertyTrackDataItems=[];e.TimelineDataManager._CreateDataItems(this._propertyTrackDataItems,
a,b,this)}Release(){this._trackDataItem=null;for(const a of this._propertyTrackDataItems)a.Release();e.clearArray(this._propertyTrackDataItems);this._propertyTrackDataItems=null}GetTrackDataItem(){return this._trackDataItem}AddEmptyPropertyTrackDataItem(){const a=new b(null,this);this._propertyTrackDataItems.push(a);return a}GetFirstPropertyKeyframeDataItem(a){return a.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray()[0]}GetLastPropertyKeyframeDataItem(a){return a.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray().at(-1)}GetPropertyKeyFrameDataItemAtTime(a,
d){d=d.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();const c=d.length;for(let f=0;f<c;f++){const h=d[f];if(h.GetTime()===a)return h}}GetFirstPropertyKeyFrameDataItemHigherThan(a,d){d=d.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();const c=d.length;for(let f=0;f<c;f++){const h=d[f];if(h.GetTime()>a)return h}}GetFirstPropertyKeyFrameDataItemHigherOrEqualThan(a,d){d=d.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();const c=d.length;for(let f=0;f<c;f++){const h=
d[f];if(h.GetTime()>=a)return h}}GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(a,d){d=d.GetPropertyKeyframeData().GetPropertyKeyframeDataItemArray();for(let c=d.length-1;0<=c;c--){const f=d[c];if(f.GetTime()<=a)return f}}*propertyTrackDataItems(){for(const a of this._propertyTrackDataItems)yield a}_SaveToJson(){return{propertyTrackDataItemsJson:this._propertyTrackDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&e.TimelineDataManager._LoadDataItemsFromJson(this._propertyTrackDataItems,a.propertyTrackDataItemsJson,
b,this)}}}
{"use strict";const e=self.C3;class b{constructor(a,d){this._keyframeData=d;this._time=-1;this._ease="noease";this._enable=!1;this._lowerTags=this._tags=null;a&&(this._time=a[0],this._ease=a[1],this._enable=!!a[2],this._tags=(a=a[3])?a.split(" "):[],this._lowerTags=new Set(this._tags.map(c=>c.toLowerCase())),this._next=null)}Release(){this._keyframeData=null;e.clearArray(this._tags);this._tags=null;this._lowerTags.clear();this._lowerTags=null}GetKeyframeData(){return this._keyframeData}GetNext(){return this._next}SetNext(a){this._next=a}GetTime(){return this._time}SetTime(a){this._time=
a;this._keyframeData._LinkKeyframeDataItems()}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetTags(){return this._tags}SetTags(a){this._tags=a?a.split(" "):[];this._lowerTags=new Set(this._tags.map(d=>d.toLowerCase()))}GetLowerTags(){return this._lowerTags}HasTag(a){return this._lowerTags.has(a.toLowerCase())}_SaveToJson(){return{time:this._time,ease:this._ease,enable:this._enable,tags:this._tags}}_LoadFromJson(a){a&&(this._time=
a.time,this._ease=a.ease,this._enable=a.enable,this._tags=a.tags,this._lowerTags=new Set(this._tags.map(d=>d.toLowerCase())))}}e.KeyframeData=class{constructor(a,d){this._trackDataItem=d;this._keyframeDataItems=[];e.TimelineDataManager._CreateDataItems(this._keyframeDataItems,a,b,this);this._LinkKeyframeDataItems()}Release(){this._trackDataItem=null;for(const a of this._keyframeDataItems)a.Release();e.clearArray(this._keyframeDataItems);this._keyframeDataItems=null}_LinkKeyframeDataItems(){this._keyframeDataItems.sort((a,
d)=>a.GetTime()-d.GetTime());for(let a=0;a<this._keyframeDataItems.length;a++)this._keyframeDataItems[a].SetNext(this._keyframeDataItems[a+1])}GetTrackDataItem(){return this._trackDataItem}GetKeyframeDataItemCount(){return this._keyframeDataItems.length}GetKeyframeDataItemArray(){return this._keyframeDataItems}AddEmptyKeyframeDataItem(){const a=new b(null,this);this._keyframeDataItems.push(a);this._LinkKeyframeDataItems();return a}DeleteKeyframeDataItems(a){for(const d of this._keyframeDataItems){if(!a(d))continue;
const c=this._keyframeDataItems.indexOf(d);-1!==c&&(d.Release(),this._keyframeDataItems.splice(c,1))}this.SortKeyframeDataItems();this._LinkKeyframeDataItems()}SortKeyframeDataItems(){this._keyframeDataItems.sort((a,d)=>a.GetTime()-d.GetTime())}GetKeyframeDataItemIndex(a){return this._keyframeDataItems.indexOf(a)}GetKeyframeDataItemFromIndex(a){return this._keyframeDataItems[a]}*keyframeDataItems(){for(const a of this._keyframeDataItems)yield a}*keyframeDataItemsReverse(){for(let a=this._keyframeDataItems.length-
1;0<=a;a--)yield this._keyframeDataItems[a]}_SaveToJson(){return{keyframeDataItemsJson:this._keyframeDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&(e.TimelineDataManager._LoadDataItemsFromJson(this._keyframeDataItems,a.keyframeDataItemsJson,b,this),this._LinkKeyframeDataItems())}}}
{"use strict";const e=self.C3;class b{constructor(a,d){this._propertyKeyframeData=d;this._aValue=this._value=null;this._type="";this._time=NaN;this._ease="noease";this._enable=!1;this._addonData=null;this._addonInstance=void 0;a&&(this._value=a[0][0],this._aValue=a[0][1],this._type=a[0][2],this._time=a[1],this._ease=a[2],this._enable=!!a[3],this._addonData=null,a[4]&&(this._addonData=new e.AddonData(a[4],this)),this._next=null)}Release(){this._propertyKeyframeData=null;this._addonData&&(this._addonData.Release(),
this._addonData=null)}GetAddonData(){return this._addonData}SetNext(a){this._next=a}GetNext(){return this._next}GetValue(){return this._value}SetValue(a){"color"===this._type&&e.IsFiniteNumber(a)?(this._value[0]=e.GetRValue(a),this._value[1]=e.GetGValue(a),this._value[2]=e.GetBValue(a)):this._value=a}GetAbsoluteValue(){return this._aValue}SetAbsoluteValue(a){"color"===this._type&&e.IsFiniteNumber(a)?(this._aValue[0]=e.GetRValue(a),this._aValue[1]=e.GetGValue(a),this._aValue[2]=e.GetBValue(a)):this._aValue=
a}GetValueWithResultMode(){const a=this._propertyKeyframeData.GetPropertyTrackDataItem().GetResultMode();if("relative"===a)return this.GetValue();if("absolute"===a)return this.GetAbsoluteValue()}GetType(){return this._type}SetType(a){this._type=a}GetTime(){return this._time}SetTime(a){this._time=a;this._propertyKeyframeData._LinkPropertyKeyframeDataItems()}GetEase(){return this._ease}SetEase(a){this._ease=a}GetEnable(){return this._enable}SetEnable(a){this._enable=!!a}GetAddOn(a){if(this._addonData){if(this._addonInstance||
null===this._addonInstance)return this._addonInstance;var d=this._addonData.GetAddDataItemArray();if(!d)return this._addonInstance=null;var c=d.length;for(let f=0;f<c;f++){const h=d[f];if(h.GetId()===a)return this._addonInstance=h}return this._addonInstance=null}}_SaveToJson(){const a=this._addonData;return{addonDataJson:a?a._SaveToJson():a,value:this._value,aValue:this._aValue,type:this._type,time:this._time,ease:this._ease,enable:this._enable}}_LoadFromJson(a){a&&(a.addonDataJson&&this._addonData._SetFromJson(a.addonDataJson),
this._value=a.value,this._aValue=a.aValue,this._type=a.type,this._time=a.time,this._ease=a.ease,this._enable=a.enable)}}e.PropertyKeyframeData=class{constructor(a,d){this._propertyTrackDataItem=d;this._propertyKeyframeDataItems=[];e.TimelineDataManager._CreateDataItems(this._propertyKeyframeDataItems,a,b,this);this._LinkPropertyKeyframeDataItems()}Release(){this._propertyTrackDataItem=null;for(const a of this._propertyKeyframeDataItems)a.Release();e.clearArray(this._propertyKeyframeDataItems);this._propertyKeyframeDataItems=
null}_LinkPropertyKeyframeDataItems(){this._propertyKeyframeDataItems.sort((a,d)=>a.GetTime()-d.GetTime());for(let a=0;a<this._propertyKeyframeDataItems.length;a++)this._propertyKeyframeDataItems[a].SetNext(this._propertyKeyframeDataItems[a+1])}AddEmptyPropertyKeyframeDataItem(){const a=new b(null,this);this._propertyKeyframeDataItems.push(a);this._LinkPropertyKeyframeDataItems();return a}DeletePropertyKeyframeDataItems(a){for(const d of this._propertyKeyframeDataItems){if(!a(d))continue;const c=
this._propertyKeyframeDataItems.indexOf(d);-1!==c&&(d.Release(),this._propertyKeyframeDataItems.splice(c,1))}this.SortPropertyKeyFrameDataItems();this._LinkPropertyKeyframeDataItems()}SortPropertyKeyFrameDataItems(){this._propertyKeyframeDataItems.sort((a,d)=>a.GetTime()-d.GetTime())}GetPropertyTrackDataItem(){return this._propertyTrackDataItem}GetPropertyKeyframeDataItemCount(){return this._propertyKeyframeDataItems.length}GetPropertyKeyframeDataItemArray(){return this._propertyKeyframeDataItems}*propertyKeyframeDataItems(){for(const a of this._propertyKeyframeDataItems)yield a}*propertyKeyframeDataItemsReverse(){for(let a=
this._propertyKeyframeDataItems.length-1;0<=a;a--)yield this._propertyKeyframeDataItems[a]}_SaveToJson(){return{propertyKeyframeDataItemsJson:this._propertyKeyframeDataItems.map(a=>a._SaveToJson())}}_LoadFromJson(a){a&&(e.TimelineDataManager._LoadDataItemsFromJson(this._propertyKeyframeDataItems,a.propertyKeyframeDataItemsJson,b,this),this._LinkPropertyKeyframeDataItems())}}}
{"use strict";const e=self.C3;class b{constructor(c,f){this._addonData=f;this._id=c[0];this._data=c[1]}Release(){this._data=this._addonData=null}GetAddonData(){return this._addonData}GetId(){return this._id}_SaveToJson(){return{id:this._id,data:this._data}}_LoadFromJson(c){c&&(this._id=c.id,this._data=c.data)}}class a extends b{constructor(c,f){super(c,f);this._startAnchor=this._data[0];this._startEnable=!!this._data[1];this._endAnchor=this._data[2];this._endEnable=!!this._data[3]}Release(){super.Release()}GetStartAnchor(){return this._startAnchor}GetStartEnable(){return this._startEnable}GetEndAnchor(){return this._endAnchor}GetEndEnable(){return this._endEnable}_SaveToJson(){return Object.assign(super._SaveToJson(),
{startAnchor:this._startAnchor,startEnable:!!this._startEnable,endAnchor:this._endAnchor,endEnable:!!this._endEnable})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._startAnchor=c.startAnchor,this._startEnable=!!c.startEnable,this._endAnchor=c.endAnchor,this._endEnable=!!c.endEnable)}}class d extends b{constructor(c,f){super(c,f);this._direction=this._data[0];this._revolutions=this._data[1]}Release(){super.Release()}GetDirection(){return this._direction}GetRevolutions(){return this._revolutions}_SaveToJson(){return Object.assign(super._SaveToJson(),
{direction:this._direction,revolutions:this._revolutions})}_LoadFromJson(c){c&&(super._LoadFromJson(c),this._direction=c.direction,this._revolutions=c.revolutions)}}e.AddonData=class{constructor(c,f){this._propertyKeyframeDataItem=f;this._addonDataItems=[];e.TimelineDataManager._CreateDataItems(this._addonDataItems,c,{prop:0,map:new Map([["cubic-bezier",a],["angle",d]])},this)}Release(){this._propertyKeyframeDataItem=null;for(const c of this._addonDataItems)c.Release();e.clearArray(this._addonDataItems);
this._addonDataItems=null}GetPropertyKeyframeDataItem(){return this._propertyKeyframeDataItem}GetAddDataItemArray(){return this._addonDataItems}*addonDataItems(){for(const c of this._addonDataItems)yield c}_SaveToJson(){return{addonDataItemsJson:this._addonDataItems.map(c=>c._SaveToJson())}}_LoadFromJson(c){c&&e.TimelineDataManager._LoadDataItemsFromJson(this._addonDataItems,c.addonDataItemsJson,{prop:"id",map:new Map([["cubic-bezier",a],["angle",d]])},this)}}}
{"use strict";const e=self.C3;let b=0;e.TweenState=class extends e.TimelineState{constructor(a,d){super(`tween-${b++}`,a,d);this._id="";this._destroyInstanceOnComplete=!1;this._initialValueMode="start-value";this._track=this._on_started_callbacks=this._on_completed_callbacks=this._instance=null}CreateTrackStates(){for(const a of this._timelineDataItem.GetTrackData().trackDataItems())this._tracks.push(e.TweenTrackState.Create(this,a));this._track=this._tracks[0]}AddTrack(){var a=this._timelineDataItem.GetTrackData().AddEmptyTrackDataItem();
a=e.TweenTrackState.Create(this,a);this._tracks.push(a);this._track=this._tracks[0];return a}GetPropertyTrack(a){return this._track.GetPropertyTracks()[0]}SetPropertyType(a){this._propertyType=a}GetInstance(){var a=this.GetTracks();if(a&&a.length&&(this._track=a=a[0])){var d=a.GetInstance();return a.IsInstanceValid()?d:void 0}}AddStartedCallback(a){this._on_started_callbacks||(this._on_started_callbacks=[]);this._on_started_callbacks.push(a)}AddCompletedCallback(a){this._on_completed_callbacks||(this._on_completed_callbacks=
[]);this._on_completed_callbacks.push(a)}RemoveStartedCallback(a){this._on_started_callbacks&&(a=this._on_started_callbacks.indexOf(a),-1!==a&&this._on_started_callbacks.splice(a,1))}RemoveCompletedCallback(a){this._on_completed_callbacks&&(a=this._on_completed_callbacks.indexOf(a),-1!==a&&this._on_completed_callbacks.splice(a,1))}SetStartValue(a,d){for(const f of this._tracks)for(const h of f._propertyTracks){if(h.GetPropertyName()!==d)continue;var c=h.GetPropertyTrackData();const g=h.GetPropertyTrackDataItem();
c=c.GetFirstPropertyKeyframeDataItem(g);c.SetValue(a);c.SetAbsoluteValue(a)}}_GetPropertyTrackState(a){for(const d of this._tracks)for(const c of d._propertyTracks)if(c.GetPropertyName()===a)return c}BeforeSetEndValues(a){for(const f of a)a=this._GetPropertyTrackState(f),this.SetStartValue(a.GetCurrentState(),f);if(this.IsForwardPlayBack()){var d=this.GetTotalTime()-this.GetTime();this.SetTotalTime(d);for(var c of this._tracks)c.SetLocalTotalTime(d);this._SetTime(0)}else{c=this.GetTime();this.SetTotalTime(c);
for(d of this._tracks)d.SetLocalTotalTime(c);this._SetTime(c)}this.SetInitialStateFromSetTime()}SetEndValue(a,d){var c=this._GetPropertyTrackState(d);d=c.GetPropertyTrackData();c=c.GetPropertyTrackDataItem();d=d.GetLastPropertyKeyframeDataItem(c);d.SetTime(this.GetTotalTime());d.SetValue(a);d.SetAbsoluteValue(a)}SetId(a){this._id=a}GetId(){return this._id}SetInitialValueMode(a){this._initialValueMode=a}GetInitialValueMode(){return this._initialValueMode}SetDestroyInstanceOnComplete(a){this._destroyInstanceOnComplete=
a}GetDestroyInstanceOnComplete(){return this._destroyInstanceOnComplete}OnStarted(){if(this._on_started_callbacks)for(const a of this._on_started_callbacks)a(this);if(!this.IsComplete())for(const a of this._tracks)a.CompareSaveStateWithCurrent()}OnCompleted(){this._completedTick=this._runtime.GetTickCount()}FinishTriggers(){if(!this._finishedTriggers&&(this._finishedTriggers=!0,this._on_completed_callbacks))for(const a of this._on_completed_callbacks)a(this)}SetTime(a){this._DeleteIntermediateKeyframes();
super.SetTime(a)}_SetTimeAndReset(a){e.IsFiniteNumber(a)||(a=this.GetTotalTime());0>a?this._playheadTime=0:a>=this.GetTotalTime()?this._playheadTime=this.GetTotalTime():this._playheadTime=a;this._track.SetResetState()}SetInitialState(a){if(!this.InitialStateSet()&&"current-state"===this.GetInitialValueMode())for(const d of this._tracks)d.CompareInitialStateWithCurrent();super.SetInitialState(a)}Stop(a=!1){super.Stop(a);if(!this.IsComplete())for(const d of this._tracks)d.SaveState()}Reset(a=!0,d=!1){this._DeleteIntermediateKeyframes();
super.Reset(a,d)}_DeleteIntermediateKeyframes(){for(const a of this._tracks){const d=c=>{c=c.GetTime();const f=this.GetTotalTime();return 0!==c&&c!==f};a.DeleteKeyframes(d);a.DeletePropertyKeyframes(d)}}_OnBeforeChangeLayout(){if(this.IsReleased())return!0;const a=this.GetInstance();if(a&&a.GetObjectClass().IsGlobal())return!1;this._timelineManager.CompleteTimelineBeforeChangeOfLayout(this);this.ResetBeforeChangeLayout();return!0}Tick(a,d,c){this._instance||(this._instance=this.GetInstance());if(this._instance&&
!this._instance.IsDestroyed()&&(d=this._instance.GetTimeScale(),-1!==d&&(a=c*d),0!==a||0!==this._lastDelta)){this._lastDelta=a;c=this._playheadTime+a*this._playbackRate;a=this._timelineDataItem._totalTime;this._playheadTime=0>c?0:c>=a?a:c;d=c=!1;var f=this.GetLoop(),h=this.GetPingPong();f||h?f&&!h?0<this._playbackRate?this._playheadTime>=a&&(this._SetTimeAndReset(0),d=!0):0>=this._playheadTime&&(this._SetTimeAndReset(a),d=!0):!f&&h?0<this._playbackRate?this._playheadTime>=a&&(this._SetTime(a),this.SetPlaybackRate(-1*
this.GetPlaybackRate()),d=!0,1===this._pingPongState?this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._pingPongState=0):c=!0:0===this._pingPongState&&(this._pingPongState=1)):0>=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),d=!0,1===this._pingPongState?this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._pingPongState=0):c=!0:0===this._pingPongState&&(this._pingPongState=1)):f&&h&&(0<this._playbackRate?
this._playheadTime>=a&&(this._SetTime(a),this.SetPlaybackRate(-1*this.GetPlaybackRate()),d=!0):0>=this._playheadTime&&(this._SetTime(0),this.SetPlaybackRate(-1*this.GetPlaybackRate()),d=!0)):0<this._playbackRate?this._playheadTime>=a&&(this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._SetTimeAndReset(0),d=!0):(this._SetTime(a),c=!0)):0>=this._playheadTime&&(this._currentRepeatCount<this.GetRepeatCount()?(this._currentRepeatCount++,this._SetTimeAndReset(a),d=!0):(this._SetTime(0),
c=!0));c?(this._track.SetEndState(),this.Stop(!0),this.OnCompleted()):(this._track.Interpolate(this._playheadTime,!0,!1,d,this._firstTick,!1),this._firstTick&&(this._firstTick=!1))}}_SaveToJson(){const a=super._SaveToJson(),d=this.GetTimelineDataItem();return Object.assign(a,{tweenDataItemJson:d._SaveToJson(),id:this._id,destroyInstanceOnComplete:this._destroyInstanceOnComplete,initialValueMode:this._initialValueMode})}_LoadFromJson(a){a&&(this.GetTimelineDataItem()._LoadFromJson(a.tweenDataItemJson),
super._LoadFromJson(a),this._id=a.id,this._destroyInstanceOnComplete=a.destroyInstanceOnComplete,this._initialValueMode=a.initialValueMode)}static IsPlaying(a){return a.IsPlaying()}static IsPaused(a){return a.IsPaused()}static Build(a){var d=a.runtime.GetTimelineManager(),c=new e.TimelineDataItem;if(a.json){c._LoadFromJson(a.json.tweenDataItemJson);var f=new e.TweenState(c,d);f._LoadFromJson(a.json);return f}d=new e.TweenState(c,d);e.IsArray(a.propertyTracksConfig)||(a.propertyTracksConfig=[a.propertyTracksConfig]);
d.SetId(a.id);d.SetTags(a.tags);d.SetInitialValueMode(a.initialValueMode);d.SetDestroyInstanceOnComplete(a.releaseOnComplete);d.SetLoop(a.loop);d.SetPingPong(a.pingPong);d.SetTotalTime(a.time);d.SetStep(0);d.SetInterpolationMode("default");d.SetResultMode(a.propertyTracksConfig[0].resultMode);c=d.AddTrack();c.SetInstanceUID(a.instance.GetUID());c.SetInterpolationMode("default");c.SetResultMode(a.propertyTracksConfig[0].resultMode);c.SetEnable(!0);c.SetObjectClassIndex(a.instance.GetObjectClass().GetIndex());
var h=a.instance.GetSdkInstance(),g=h.IsOriginalSizeKnown()?h.GetOriginalWidth():a.instance.GetWorldInfo().GetWidth();h=h.IsOriginalSizeKnown()?h.GetOriginalHeight():a.instance.GetWorldInfo().GetHeight();c.SetOriginalWidth(g);c.SetOriginalHeight(h);g=c.AddKeyframe();g.SetTime(0);g.SetEase("noease");g.SetEnable(!0);g.SetTags("");g=c.AddKeyframe();g.SetTime(a.time);g.SetEase("noease");g.SetEnable(!0);g.SetTags("");for(f of a.propertyTracksConfig)g=c.AddPropertyTrack(),g.SetSourceAdapterId(f.sourceId),
g.SetSourceAdapterArgs(f.sourceArgs),g.SetPropertyName(f.property),g.SetPropertyType(f.type),g.SetMin(NaN),g.SetMax(NaN),g.SetInterpolationMode("default"),g.SetResultMode(f.resultMode),g.SetEnable(!0),h=g.AddPropertyKeyframe(),h.SetType(f.valueType),h.SetTime(0),h.SetEase(f.ease),h.SetEnable(!0),h.SetValue(f.startValue),h.SetAbsoluteValue(f.startValue),h=g.AddPropertyKeyframe(),h.SetType(f.valueType),h.SetTime(a.time),h.SetEase(f.ease),h.SetEnable(!0),h.SetValue(f.endValue),h.SetAbsoluteValue(f.endValue),
g.GetSourceAdapter();return d}}}
{"use strict";const e=self.C3;e.TweenTrackState=class extends e.TrackState{constructor(b,a){super(b,a);this._secondPropertyTrack=this._firstPropertyTrack=null}static Create(b,a){return e.New(e.TweenTrackState,b,a)}_CachePropertyTracks(){1===this._propertyTracks.length?this._firstPropertyTrack=this._propertyTracks[0]:(this._firstPropertyTrack=this._propertyTracks[0],this._secondPropertyTrack=this._propertyTracks[1])}CreatePropertyTrackStates(){for(const b of this._trackDataItem.GetPropertyTrackData().propertyTrackDataItems())this._propertyTracks.push(e.TweenPropertyTrackState.Create(this,b));
this._CachePropertyTracks()}AddPropertyTrack(){var b=this._trackDataItem.GetPropertyTrackData().AddEmptyPropertyTrackDataItem();b=e.TweenPropertyTrackState.Create(this,b);this._propertyTracks.push(b);this._CachePropertyTracks();return b}BeforeInterpolate(){}Interpolate(b,a,d=!1,c=!1,f,h=!1){this._instance||this.GetInstance();if(this._instance){if(this._instance.IsDestroyed()||h&&this.GetObjectClass().IsGlobal())return!1;this._secondPropertyTrack?(this._firstPropertyTrack.Interpolate(b,d,c),this._secondPropertyTrack.Interpolate(b,
d,c)):this._firstPropertyTrack.Interpolate(b,d,c);0!==this._firstPropertyTrack.GetWorldInfoChange()&&(this._worldInfo||(this._worldInfo=this._instance.GetWorldInfo()),this._worldInfo&&this._worldInfo.SetBboxChanged())}}AfterInterpolate(){}_LoadFromJson(b){super._LoadFromJson(b);this._CachePropertyTracks()}}}
{"use strict";const e=self.C3;e.TweenPropertyTrackState=class extends e.PropertyTrackState{constructor(b,a){super(b,a);this._basic=!1}static Create(b,a){return e.New(e.TweenPropertyTrackState,b,a)}Interpolate(b,a=!1,d=!1){if(this._basic){var c=this._propertyKeyframeDataItems[0];var f=this._propertyKeyframeDataItems[1]}else{if(a)c=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);else{if(this._lastPropertyKeyframeDataItem){f=this.GetTimeline();
const h=this._lastPropertyKeyframeDataItem.GetNext();c=this._lastPropertyKeyframeDataItem.GetTime();f=h?h.GetTime():f.GetTotalTime();if(b<=c||b>=f)this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem)}else this._lastPropertyKeyframeDataItem=this._propertyTrackData.GetFirstPropertyKeyFrameDataItemLowerOrEqualThan(b,this._propertyTrackDataItem);c=this._lastPropertyKeyframeDataItem}f=c.GetNext()}this._sourceAdapter.Interpolate(b,
c,f,a,d)}AddPropertyKeyframe(){const b=this._propertyTrackDataItem.GetPropertyKeyframeData().AddEmptyPropertyKeyframeDataItem();this._lastPropertyKeyframeDataItem=null;this._basic=2>=this.GetPropertyKeyframeDataItems().length;return b}DeletePropertyKeyframes(b){this._lastPropertyKeyframeDataItem=null;this._propertyTrackDataItem.GetPropertyKeyframeData().DeletePropertyKeyframeDataItems(b);this._basic=2>=this.GetPropertyKeyframeDataItems().length}_SaveToJson(){return{sourceAdapterJson:this.GetSourceAdapter()._SaveToJson(),
basic:this._basic}}_LoadFromJson(b){b&&(this.GetSourceAdapter()._LoadFromJson(b.sourceAdapterJson),this._basic=b.basic)}}}
{"use strict";const e=self.C3,b=self.Ease;e.Transition=class extends e.DefendedBase{constructor(a){super();this._name=a[0];this._transitionKeyframes=[];for(var d of a[1])a=e.TransitionKeyframe.Create(this,d),this._transitionKeyframes.push(a);for(d=0;d<this._transitionKeyframes.length;d++)this._transitionKeyframes[d].SetNext(this._transitionKeyframes[d+1]);this._precalculatedSamples=new Map;this._transitionKeyframeCache=new Map;this._PreCalcSamples();b.AddCustomEase(this._name,(c,f,h,g)=>this.Interpolate(c,
f,h,g))}static Create(a){return e.New(e.Transition,a)}Release(){for(const a of this._transitionKeyframes)a.Release();e.clearArray(this._transitionKeyframes);this._transitionKeyframes=null;this._precalculatedSamples.clear();this._precalculatedSamples=null;this._transitionKeyframeCache.clear();this._transitionKeyframeCache=null}GetTransitionKeyFrameAt(a){const d=this._transitionKeyframeCache.get(a);if(d)return d;for(const c of this._transitionKeyframes)if(c.GetValueX()===a)return this._transitionKeyframeCache.set(a,
c),c}GetFirstTransitionKeyFrameHigherThan(a){for(const d of this._transitionKeyframes)if(d.GetValueX()>a)return d}GetFirstTransitionKeyFrameHigherOrEqualThan(a){for(const d of this._transitionKeyframes)if(d.GetValueX()>=a)return d}GetFirstTransitionKeyFrameLowerThan(a){for(let d=this._transitionKeyframes.length-1;0<=d;d--){const c=this._transitionKeyframes[d];if(c.GetValueX()<a)return c}}GetFirstTransitionKeyFrameLowerOrEqualThan(a){for(let d=this._transitionKeyframes.length-1;0<=d;d--){const c=this._transitionKeyframes[d];
if(c.GetValueX()<=a)return c}}Interpolate(a,d,c,f){var h=a/f;a=this.GetFirstTransitionKeyFrameLowerOrEqualThan(h);f=a.GetNext();f||(a=this.GetFirstTransitionKeyFrameLowerThan(h),f=a.GetNext());var g=f.GetValueX()-a.GetValueX();h=e.mapToRange(h,a.GetValueX(),f.GetValueX(),0,g);g=a.GetValueX();const l=a.GetValueY(),m=a.GetValueX()+a.GetStartAnchorX(),u=a.GetValueY()+a.GetStartAnchorY(),w=f.GetValueX()+f.GetEndAnchorX(),q=f.GetValueY()+f.GetEndAnchorY(),t=f.GetValueX();f=f.GetValueY();f=b.GetRuntimeEase("spline")(h,
g,l,m,u,w,q,t,f,this._precalculatedSamples.get(a));f+=a.GetValueY();return(1-f)*d+f*(d+c)}_PreCalcSamples(){this._precalculatedSamples.clear();for(let c=0;c<this._transitionKeyframes.length-1;c++){var a=this._transitionKeyframes[c];if(!a.GetStartEnable())continue;var d=this._transitionKeyframes[c+1];const f=a.GetValueX(),h=a.GetValueX()+a.GetStartAnchorX(),g=d.GetValueX()+d.GetEndAnchorX();d=d.GetValueX();this._precalculatedSamples.set(a,b.GetBezierSamples(f,h,g,d))}}}}
{"use strict";const e=self.C3;e.TransitionKeyframe=class extends e.DefendedBase{constructor(b,a){super();this._transition=b;this._valueX=a[0];this._valueY=a[1];this._startAnchorX=a[2];this._startAnchorY=a[3];this._endAnchorX=a[4];this._endAnchorY=a[5];this._startEnable=a[6];this._endEnable=a[7];this._next=null}Release(){this._transition=null}static Create(b,a){return e.New(e.TransitionKeyframe,b,a)}SetNext(b){this._next=b}GetNext(){return this._next}GetValueX(){return this._valueX}GetValueY(){return this._valueY}GetStartAnchorX(){return this._startAnchorX}GetStartAnchorY(){return this._startAnchorY}GetEndAnchorX(){return this._endAnchorX}GetEndAnchorY(){return this._endAnchorY}GetStartEnable(){return this._startEnable}GetEndEnable(){return this._endEnable}}}
{"use strict";const e=self.C3;e.TransitionManager=class extends e.DefendedBase{constructor(b){super();this._runtime=b;this._transitions=[]}Release(){for(const b of this._transitions)b.Release();e.clearArray(this._transitions);this._transitions=null}Create(b){this._transitions.push(e.Transition.Create(b))}}}
{"use strict";const e=self.C3;e.SolStack=class extends e.DefendedBase{constructor(b){super();this._objectClass=b;this._stack=[];this._stack.push(e.New(e.Sol,this));this._index=0;this._current=this._stack[0]}Release(){for(const b of this._stack)b.Release();e.clearArray(this._stack);this._objectClass=this._current=null}GetObjectClass(){return this._objectClass}GetCurrentSol(){return this._current}Clear(){this.GetCurrentSol().Clear()}PushClean(){var b=this._stack,a=++this._index;a===b.length?(a=e.New(e.Sol,
this),b.push(a),this._current=a):(b=b[a],b.Reset(),this._current=b)}PushCopy(){const b=this._stack,a=++this._index;a===b.length&&b.push(e.New(e.Sol,this));const d=b[a];d.Copy(b[a-1]);this._current=d}Pop(){this._current=this._stack[--this._index]}RemoveInstances(b){const a=this._stack;for(let d=0,c=a.length;d<c;++d)a[d].RemoveInstances(b)}}}
{"use strict";const e=self.C3;e.Sol=class extends e.DefendedBase{constructor(b){super();this._stack=b;this._objectClass=this._stack.GetObjectClass();this._eventStack=this._objectClass.GetRuntime().GetEventStack();this._selectAll=!0;this._instances=[];this._elseInstances=[]}Release(){this.ClearArrays();this._eventStack=this._objectClass=this._stack=null}ClearArrays(){e.clearArray(this._instances);e.clearArray(this._elseInstances)}GetObjectClass(){return this._objectClass}IsSelectAll(){return this._selectAll}HasAnyInstances(){return this._selectAll?
!!this._objectClass.GetInstanceCount():!!this._instances.length}GetInstances(){return this._selectAll?this._objectClass.GetInstances():this._instances}HasAnyElseInstances(){return!!this._elseInstances.length}GetElseInstances(){return this._elseInstances}GetExpressionInstances(){const b=this.GetInstances();return b.length?b:this._elseInstances}Reset(){this._selectAll=!0;e.clearArray(this._elseInstances)}Clear(){this._selectAll=!0}Copy(b){b.IsSelectAll()?this.Reset():(this._selectAll=!1,e.shallowAssignArray(this._instances,
b._instances),e.clearArray(this._elseInstances))}_PushInstance(b){this._instances.push(b)}_PushElseInstance(b){this._elseInstances.push(b)}_SetSelectAll(b){this._selectAll=!!b}_GetOwnInstances(){return this._instances}_GetOwnElseInstances(){return this._elseInstances}SetSinglePicked(b){this._selectAll=!1;e.clearArray(this._instances);this._instances.push(b)}SetArrayPicked(b){this._selectAll=!1;e.shallowAssignArray(this._instances,b)}SetSetPicked(b){this._selectAll=!1;e.clearArray(this._instances);
for(const a of b)this._instances.push(a)}AddElseInstances(b,a){for(const d of a)b.has(d)||this._elseInstances.push(d)}TransferElseInstancesToOwn(b){for(const a of b)this._instances.push(a);e.arrayRemoveAllInSet(this._elseInstances,b)}PickOne(b){b&&(this._eventStack.GetCurrentStackFrame().GetCurrentEvent().IsOrBlock()?(this.IsSelectAll()&&(e.clearArray(this._instances),e.shallowAssignArray(this._elseInstances,b.GetObjectClass().GetInstances()),this._selectAll=!1),b=this._elseInstances.indexOf(b),-1!==
b&&(this._instances.push(this._elseInstances[b]),this._elseInstances.splice(b,1))):this.SetSinglePicked(b))}RemoveInstances(b){e.arrayRemoveAllInSet(this._instances,b);e.arrayRemoveAllInSet(this._elseInstances,b)}}}
{"use strict";const e=self.C3;e.EventStack=class extends e.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._stack.push(e.New(e.EventStackFrame,this,null));this._index=0;this._expFuncStack=[]}Release(){for(const b of this._stack)b.Release();e.clearArray(this._stack);e.clearArray(this._expFuncStack);this._runtime=this._eventSheetManager=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrentStackFrame(){return this._stack[this._index]}Push(b){var a=
this._stack;const d=++this._index;if(d===a.length)return b=e.New(e.EventStackFrame,this,b),a.push(b),b;a=a[d];a.Reset(b);return a}Pop(){--this._index}PushExpFunc(b){this._expFuncStack.push(b)}PopExpFunc(){this._expFuncStack.pop()}GetCurrentExpFuncStackFrame(){const b=this._expFuncStack;return 0===b.length?null:b.at(-1)}}}
{"use strict";const e=self.C3;e.EventStackFrame=class extends e.DefendedBase{constructor(b,a){super();this._stack=b;this._runtime=this._stack.GetRuntime();this._currentEvent=a;this._actIndex=this._cndIndex=0;this._elseBranchRan=this._lastEventTrue=!1;this._expressionObjectClass=null;this._functionReturnValue=this._functionReturnType=0}Release(){this.Reset(null);this._runtime=this._stack=null}Reset(b){this._currentEvent=b;this._actIndex=this._cndIndex=0;this._elseBranchRan=this._lastEventTrue=!1}_Restore(b,
a){this._currentEvent=b;this._cndIndex=0;this._actIndex=a}ResetQuick(){this._actIndex=this._cndIndex=0}GetCurrentEvent(){return this._currentEvent}SetCurrentEvent(b){this._currentEvent=b}GetConditionIndex(){return this._cndIndex}SetConditionIndex(b){this._cndIndex=b}GetActionIndex(){return this._actIndex}SetActionIndex(b){this._actIndex=b}SetLastEventTrue(b){this._lastEventTrue=!!b}GetLastEventTrue(){return this._lastEventTrue}SetElseBranchRan(b){this._elseBranchRan=!!b}GetElseBranchRan(){return this._elseBranchRan}SetExpressionObjectClass(b){this._expressionObjectClass=
b}GetExpressionObjectClass(){return this._expressionObjectClass}InitCallFunctionExpression(b,a){this._functionReturnType=b;this._functionReturnValue=a}GetFunctionReturnType(){return this._functionReturnType}SetFunctionReturnValue(b){this._functionReturnValue=b}GetFunctionReturnValue(){return this._functionReturnValue}IsSolModifierAfterCnds(){const b=this._currentEvent;return b.IsSolWriterAfterCnds()?!0:this._cndIndex<b.GetConditionCount()-1?!!b.GetSolModifiers().length:!1}}}
{"use strict";const e=self.C3;e.LocalVarStack=class extends e.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1;this._current=null;this._initialValues=[]}Release(){e.clearArray(this._stack);this._runtime=this._eventSheetManager=null}_SetInitialValues(b){this._initialValues=b;b=this._initialValues.slice(0);this._stack.push(b);this._index=0;this._current=b}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetCurrent(){return this._current}Push(){const b=
++this._index,a=this._stack;b===a.length?a.push(this._initialValues.slice(0)):e.shallowAssignArray(a[b],this._initialValues);this._current=a[b]}Pop(){this._current=this._stack[--this._index]}}}
{"use strict";const e=self.C3;e.LoopStack=class extends e.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._runtime=this._eventSheetManager.GetRuntime();this._stack=[];this._index=-1}Release(){e.clearArray(this._stack);this._runtime=this._eventSheetManager=null}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}IsInLoop(){return 0<=this._index}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){var b=
e.New(e.Loop,this);this._stack.push(b);return b}b=this._stack[this._index];b.Reset();return b}Pop(){--this._index}FindByName(b){const a=this._stack;for(let d=this._index;0<=d;--d){const c=a[d];if(c.GetName()===b)return c}return null}_GetStack(){return this._stack.slice(0,this._index+1)}}}
{"use strict";const e=self.C3;e.Loop=class extends e.DefendedBase{constructor(b){super();this._loopStack=b;this._name="";this._index=0;this._isStopped=!1;this._end=NaN}Reset(){this._name="";this._index=0;this._isStopped=!1;this._end=NaN}SetName(b){this._name=b}GetName(){return this._name}SetIndex(b){this._index=b}GetIndex(){return this._index}Stop(){this._isStopped=!0}IsStopped(){return this._isStopped}SetEnd(b){this._end=b}GetEnd(){return this._end}}}
{"use strict";const e=self.C3;e.ArrayStack=class extends e.DefendedBase{constructor(){super();this._stack=[];this._index=-1}Release(){e.clearArray(this._stack)}GetCurrent(){return this._stack[this._index]}Push(){++this._index;if(this._index===this._stack.length){const b=[];this._stack.push(b);return b}return this._stack[this._index]}Pop(){--this._index}}}
{"use strict";const e=self.C3;function b(d,c){return d.GetIndex()-c.GetIndex()}function a(d,c){for(let f=0,h=d.length;f<h;++f)if(d[f]!==c[f])return!1;return!0}e.EventSheetManager=class extends e.DefendedBase{constructor(d){super();this._runtime=d;this._allSheets=[];this._sheetsByName=new Map;this._allGroups=[];this._groupsByName=new Map;this._blocksBySid=new Map;this._cndsBySid=new Map;this._actsBySid=new Map;this._allUniqueSolModifiers=new Map;this._eventVarsBySid=new Map;this._nextLocalVarIndex=
0;this._allGlobalVars=[];this._allLocalVars=[];this._localVarInitialValues=[];this._functionBlocksByName=new Map;this._eventStack=e.New(e.EventStack,this);this._localVarStack=e.New(e.LocalVarStack,this);this._loopStack=e.New(e.LoopStack,this);this._triggersToPostInit=[];this._queuedTriggers=[];this._queuedDebugTriggers=[];this._blockFlushingDepth=this._executingTriggerDepth=this._runningEventsDepth=0;this._scheduledWaits=[];this._asyncActionPromises=[];self.c3_callFunction=(c,f)=>this._InvokeFunctionFromJS(c,
f)}Release(){this.ClearAllScheduledWaits();this._eventStack.Release();this._eventStack=null;this._localVarStack.Release();this._localVarStack=null;e.clearArray(this._queuedTriggers);e.clearArray(this._queuedDebugTriggers);this._runtime=null;e.clearArray(this._allSheets);this._sheetsByName.clear()}Create(d){d=e.New(e.EventSheet,this,d);this._allSheets.push(d);this._sheetsByName.set(d.GetName().toLowerCase(),d)}_AddTriggerToPostInit(d){this._triggersToPostInit.push(d)}_PostInit(){for(const d of this._functionBlocksByName.values())d._PostInit(!1);
for(const d of this._allSheets)d._PostInit();for(const d of this._allSheets)d._UpdateDeepIncludes();for(const d of this._triggersToPostInit)d._PostInit(!1);e.clearArray(this._triggersToPostInit);this._localVarStack._SetInitialValues(this._localVarInitialValues)}GetRuntime(){return this._runtime}GetEventSheetByName(d){return this._sheetsByName.get(d.toLowerCase())||null}_RegisterGroup(d){this._allGroups.push(d);this._groupsByName.set(d.GetGroupName(),d)}_RegisterEventBlock(d){this._blocksBySid.set(d.GetSID(),
d)}_RegisterCondition(d){this._cndsBySid.set(d.GetSID(),d)}_RegisterAction(d){this._actsBySid.set(d.GetSID(),d)}_RegisterFunctionBlock(d){this._functionBlocksByName.set(d.GetFunctionName().toLowerCase(),d)}_RegisterEventVariable(d){this._eventVarsBySid.set(d.GetSID(),d);d.IsGlobal()?this._allGlobalVars.push(d):this._allLocalVars.push(d)}_DeduplicateSolModifierList(d){2<=d.length&&d.sort(b);let c=this._allUniqueSolModifiers.get(d.length);c||(c=[],this._allUniqueSolModifiers.set(d.length,c));for(let f=
0,h=c.length;f<h;++f){const g=c[f];if(a(d,g))return g}c.push(d);return d}_GetNextLocalVarIndex(d){this._localVarInitialValues.push(d.GetInitialValue());return this._nextLocalVarIndex++}GetEventStack(){return this._eventStack}GetCurrentEventStackFrame(){return this.GetEventStack().GetCurrentStackFrame()}GetCurrentEvent(){return this.GetCurrentEventStackFrame().GetCurrentEvent()}GetCurrentCondition(){const d=this.GetCurrentEventStackFrame();return d.GetCurrentEvent().GetConditionAt(d.GetConditionIndex())}GetCurrentAction(){const d=
this.GetCurrentEventStackFrame();return d.GetCurrentEvent().GetActionAt(d.GetActionIndex())}GetLocalVarStack(){return this._localVarStack}GetLoopStack(){return this._loopStack}GetAllLocalVariablesInScope(d){const c=[];for(d=d.GetScopeParent();d;)e.appendArray(c,d._GetAllLocalVariablesInScope()),d=d.GetScopeParent();return c}_GetLocalVariablesScriptInterface(d){const c={};for(const f of this.GetAllLocalVariablesInScope(d))c[f.GetJsPropName()]=f._GetScriptInterfaceDescriptor();return Object.create(Object.prototype,
c)}GetEventVariableBySID(d){return this._eventVarsBySid.get(d)||null}GetEventBlockBySID(d){return this._blocksBySid.get(d)||null}GetConditionBySID(d){return this._cndsBySid.get(d)||null}GetActionBySID(d){return this._actsBySid.get(d)||null}GetFunctionBlockByName(d){return this._functionBlocksByName.get(d.toLowerCase())||null}GetAllGlobalVariables(){return this._allGlobalVars}GetAllLocalVariables(){return this._allLocalVars}ResetAllGlobalsToInitialValue(){for(const d of this._allGlobalVars)d.ResetToInitialValue()}GetEventGroupByName(d){return this._groupsByName.get(d.toLowerCase())||
null}GetEventGroupBySID(d){return(d=this._blocksBySid.get(d))&&d.IsGroup()?d:null}GetAllGroups(){return this._allGroups}ResetAllGroupsInitialActivation(){for(const d of this._allGroups)d.ResetInitialActivation()}_ResetAllHasRunFlags(){for(const d of this._allSheets)d._ResetHasRunFlag()}RunEvents(d){this._ResetAllHasRunFlags();this._runningEventsDepth++;for(const c of d.runningLayouts())if(d=c.GetEventSheet())this._runtime.PushCurrentLayout(c),d.Run(),this._runtime.PopCurrentLayout();this._runningEventsDepth--}async DebugRunEvents(d){this._ResetAllHasRunFlags();
this._runningEventsDepth++;for(const c of this._DebugRunEventsGen(d))await this._runtime.DebugBreak(c);this._runningEventsDepth--}*_DebugRunEventsGen(d){for(const c of d.runningLayouts())if(d=c.GetEventSheet())this._runtime.PushCurrentLayout(c),yield*d.DebugRun(),this._runtime.PopCurrentLayout()}_Trigger(d,c,f,h){let g=!1;if(!d.GetMainRunningLayout())return this.QueueTrigger(c,f,h);this._executingTriggerDepth++;for(const l of d.runningLayouts())if(d=l.GetEventSheet()){this._runtime.PushCurrentLayout(l);
for(const m of d.deepIncludes()){const u=m._Trigger(c,f,h);g=g||u}d=d._Trigger(c,f,h);g=g||d;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;return g}*_DebugTrigger(d,c,f,h){let g=!1;if(!d.GetMainRunningLayout())return this.QueueTrigger(c,f,h);this._executingTriggerDepth++;for(const l of d.runningLayouts())if(d=l.GetEventSheet()){this._runtime.PushCurrentLayout(l);for(const m of d.deepIncludes()){const u=yield*m._DebugTrigger(c,f,h);g=g||u}d=yield*d._DebugTrigger(c,f,h);g=g||d;this._runtime.PopCurrentLayout()}this._executingTriggerDepth--;
return g}QueueTrigger(d,c,f){this._queuedTriggers.push([d,c,f]);return!1}QueueDebugTrigger(d,c,f){let h=null;const g=new Promise(l=>h=l);this._queuedDebugTriggers.push([d,c,f,h]);return g}*_RunQueuedDebugTriggersGen(){if(this._runtime.HitBreakpoint())throw Error("should not be in breakpoint");const d=this._runtime.GetLayoutManager();for(;this._queuedDebugTriggers.length;){const [c,f,h,g]=this._queuedDebugTriggers.shift(),l=yield*this._DebugTrigger(d,c,f,h);g(l)}}async RunQueuedDebugTriggersAsync(){for(const d of this._RunQueuedDebugTriggersGen())await this._runtime.DebugBreak(d)}_FastTrigger(d,
c,f,h){let g=!1;var l=d.GetMainRunningLayout();if(d=l.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(l);l=d.deepIncludes();for(let m=0,u=l.length;m<u;++m){const w=l[m]._FastTrigger(c,f,h);g=g||w}c=d._FastTrigger(c,f,h);g=g||c;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return g}}*_DebugFastTrigger(d,c,f,h){let g=!1;var l=d.GetMainRunningLayout();if(d=l.GetEventSheet()){this._executingTriggerDepth++;this._runtime.PushCurrentLayout(l);l=d.deepIncludes();
for(let m=0,u=l.length;m<u;++m){const w=yield*l[m]._DebugFastTrigger(c,f,h);g=g||w}c=yield*d._DebugFastTrigger(c,f,h);g=g||c;this._runtime.PopCurrentLayout();this._executingTriggerDepth--;return g}}GetTriggerDepth(){return this._executingTriggerDepth}IsInTrigger(){return 0<this.GetTriggerDepth()}_IncTriggerDepth(){return++this._executingTriggerDepth}_DecTriggerDepth(){--this._executingTriggerDepth}IsRunningEvents(){return 0<this._runningEventsDepth}IsInEventEngine(){return this.IsRunningEvents()||
this.IsInTrigger()}_RunQueuedTriggers(d){for(const [c,f,h]of this._queuedTriggers)this._Trigger(d,c,f,h);e.clearArray(this._queuedTriggers)}BlockFlushingInstances(d){d?this._blockFlushingDepth++:this._blockFlushingDepth--}IsFlushingBlocked(){return 0<this._blockFlushingDepth}ClearSol(d){for(let c=0,f=d.length;c<f;++c)d[c].GetSolStack().Clear()}PushCleanSol(d){for(let c=0,f=d.length;c<f;++c)d[c].GetSolStack().PushClean()}PushCopySol(d){for(let c=0,f=d.length;c<f;++c)d[c].GetSolStack().PushCopy()}PopSol(d){for(let c=
0,f=d.length;c<f;++c)d[c].GetSolStack().Pop()}AddScheduledWait(){const d=e.New(e.ScheduledWait,this);this._scheduledWaits.push(d);return d}scheduledWaits(){return this._scheduledWaits}RunScheduledWaits(){if(this._scheduledWaits.length){var d=this.GetCurrentEventStackFrame(),c=!1;this._runningEventsDepth++;for(let f=0,h=this._scheduledWaits.length;f<h;++f){const g=this._scheduledWaits[f];g._ShouldRun()&&g._Run(d);g.ShouldRelease()&&(c=!0)}c&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}async DebugRunScheduledWaits(){if(this._scheduledWaits.length){var d=
this.GetCurrentEventStackFrame(),c=!1;this._runningEventsDepth++;for(let f=0,h=this._scheduledWaits.length;f<h;++f){const g=this._scheduledWaits[f];g._ShouldRun()&&await g._DebugRun(d);g.ShouldRelease()&&(c=!0)}c&&this._FilterScheduledWaitsToRelease();this._runningEventsDepth--}}_FilterScheduledWaitsToRelease(){const d=e.arrayFilterOut(this._scheduledWaits,c=>c.ShouldRelease());for(const c of d)c.Release()}ClearAllScheduledWaits(){for(const d of this._scheduledWaits)d.Release();e.clearArray(this._scheduledWaits)}RemoveInstancesFromScheduledWaits(d){for(const c of this._scheduledWaits)c.RemoveInstances(d)}AddAsyncActionPromise(d){this._asyncActionPromises.push(d)}ClearAsyncActionPromises(){e.clearArray(this._asyncActionPromises)}GetPromiseForAllAsyncActions(){const d=
Promise.all(this._asyncActionPromises);this._asyncActionPromises=[];return d}_SaveToJson(){return{groups:this._SaveGroupsToJson(),cnds:this._SaveCndsToJson(),acts:this._SaveActsToJson(),vars:this._SaveVarsToJson(),waits:this._SaveScheduledWaitsToJson()}}_LoadFromJson(d){this._LoadGroupsFromJson(d.groups);this._LoadCndsFromJson(d.cnds);this._LoadActsFromJson(d.acts);this._LoadVarsFromJson(d.vars);this._LoadScheduledWaitsFromJson(d.waits)}_SaveGroupsToJson(){const d={};for(const c of this.GetAllGroups())d[c.GetSID().toString()]=
c.IsGroupActive();return d}_LoadGroupsFromJson(d){for(const [c,f]of Object.entries(d))d=parseInt(c,10),(d=this.GetEventGroupBySID(d))&&d.SetGroupActive(f)}_SaveCndsToJson(){const d={};for(const [c,f]of this._cndsBySid){const h=f._SaveToJson();h&&(d[c.toString()]=h)}return d}_LoadCndsFromJson(d){const c=new Map;for(const [f,h]of Object.entries(d))c.set(parseInt(f,10),h);for(const [f,h]of this._cndsBySid)h._LoadFromJson(c.get(f)||null)}_SaveActsToJson(){const d={};for(const [c,f]of this._actsBySid){const h=
f._SaveToJson();h&&(d[c.toString()]=h)}return d}_LoadActsFromJson(d){const c=new Map;for(const [f,h]of Object.entries(d))c.set(parseInt(f,10),h);for(const [f,h]of this._actsBySid)h._LoadFromJson(c.get(f)||null)}_SaveVarsToJson(){const d={};for(const [c,f]of this._eventVarsBySid)f.IsConstant()||!f.IsGlobal()&&!f.IsStatic()||(d[c.toString()]=f.GetValue());return d}_LoadVarsFromJson(d){for(const [c,f]of Object.entries(d))d=parseInt(c,10),(d=this.GetEventVariableBySID(d))&&d.SetValue(f)}_SaveScheduledWaitsToJson(){return this._scheduledWaits.filter(d=>
!d.IsPromise()).map(d=>d._SaveToJson())}_LoadScheduledWaitsFromJson(d){this.ClearAllScheduledWaits();for(const c of d)(d=e.ScheduledWait._CreateFromJson(this,c))&&this._scheduledWaits.push(d)}_GetPerfRecords(){return[...this._runtime.GetLayoutManager().runningLayouts()].map(d=>d.GetEventSheet()).filter(d=>d).map(d=>d._GetPerfRecord())}FindFirstFunctionBlockParent(d){for(;d;)if(d=d.GetScopeParent(),d instanceof e.FunctionBlock)return d;return null}_InvokeFunctionFromJS(d,c){Array.isArray(c)||(c=[]);
d=this.GetFunctionBlockByName(d.toLowerCase());if(!d)return null;if(!d.IsEnabled())return d.GetDefaultReturnValue();var f=d.GetFunctionParameters();if(c.length<f.length){c=c.slice(0);do c.push(f[c.length].GetInitialValue());while(c.length<f.length)}f=d.GetEventBlock();return f.RunAsExpressionFunctionCall(f.GetSolModifiersIncludingParents(),d.GetReturnType(),d.GetDefaultReturnValue(),...c)}}}
{"use strict";const e=self.C3;e.EventSheet=class extends e.DefendedBase{constructor(b,a){super();this._eventSheetManager=b;this._runtime=b.GetRuntime();this._name=a[0];this._events=[];this._triggers=new Map;this._fastTriggers=new Map;this._eventsByDisplayNumber=new Map;this._hasRun=!1;this._shallowIncludes=[];this._deepIncludes=[];this._alreadyIncludedSheets=new Set;for(const d of a[1])this._CreateEvent(d,null,this._events);this._perfRecord=this._runtime.IsDebug()?{type:"sheet",name:this._name,totalTimeCounter:0,
children:[]}:null}Release(){this._runtime=this._eventSheetManager=null}_CreateEvent(b,a,d){switch(b[0]){case 0:case 3:this._CreateEventBlock(b,a,d);break;case 1:this._CreateEventVariable(b,a,d);break;case 2:this._CreateInclude(b,a,d);break;case 4:this._CreateFunctionBlock(b,a);break;case 5:this._CreateScriptBlock(b,a,d);break;default:throw Error("invalid event type");}}_CreateEventBlock(b,a,d){b=e.EventBlock.Create(this,a,b);if(b.IsOrBlock()){d.push(b);d=b.GetConditions();for(let c=0,f=d.length;c<
f;++c)d[c].IsTrigger()&&this._InitTrigger(b,c)}else b.IsTrigger()?this._InitTrigger(b,0):d.push(b)}_CreateFunctionBlock(b,a){b=e.FunctionBlock.Create(this,a,b);this._eventSheetManager._RegisterFunctionBlock(b)}_CreateEventVariable(b,a,d){b=e.EventVariable.Create(this,a,b);d.push(b)}_CreateInclude(b,a,d){b=e.EventInclude.Create(this,a,b);d.push(b)}_CreateScriptBlock(b,a,d){b=e.EventScript.Create(this,a,b);d.push(b)}_InitTrigger(b,a){b.IsOrBlock()||this._eventSheetManager._AddTriggerToPostInit(b);var d=
b.GetConditionAt(a),c=d._GetFunc(),f=d.GetObjectClass();if(d.IsFastTrigger()){var h=this._fastTriggers.get(f);h||(h=new Map,this._fastTriggers.set(f,h));d=d.GetFastTriggerValue().toLowerCase();f=h.get(c);f||(f=new Map,h.set(c,f));c=f.get(d);c||(c=[],f.set(d,c));c.push([b,a])}else h=this._triggers.get(f),h||(h={methodMap:new Map,behaviors:new Map},this._triggers.set(f,h)),(f=d.GetBehaviorType())?(d=h.behaviors.get(f),d||(d=new Map,h.behaviors.set(f,d))):d=h.methodMap,h=d.get(c),h||(h=[],d.set(c,h)),
h.push([b,a])}_PostInit(){const b=this._events;for(let a=0,d=b.length;a<d;++a){const c=a<d-1&&b[a+1]instanceof e.EventBlock&&b[a+1].IsElseBlock();b[a]._PostInit(c)}}_AddShallowInclude(b){this._shallowIncludes.push(b)}_UpdateDeepIncludes(){e.clearArray(this._deepIncludes);this._AddDeepIncludes(this);this._alreadyIncludedSheets.clear()}_AddDeepIncludes(b){const a=b._deepIncludes,d=b._alreadyIncludedSheets;for(const c of this._shallowIncludes){const f=c.GetIncludeSheet();c.IsActive()&&b!==f&&!d.has(f)&&
(d.add(f),f._AddDeepIncludes(b),a.push(f))}}deepIncludes(){return this._deepIncludes}GetEventSheetManager(){return this._eventSheetManager}GetRuntime(){return this._runtime}GetName(){return this._name}_RegisterEventByDisplayNumber(b,a){this._eventsByDisplayNumber.set(a,b)}_GetEventByDisplayNumber(b){return this._eventsByDisplayNumber.get(b)||null}_ResetHasRunFlag(){this._hasRun=!1}Run(){if(!this._hasRun){var b=this._runtime,a=b.IsCPUProfiling(),d=a?performance.now():0;this._hasRun=!0;var c=this.GetEventSheetManager(),
f=c.GetCurrentEventStackFrame();for(const h of this._events)h.Run(f),c.ClearSol(h.GetSolModifiers()),c.ClearAsyncActionPromises(),b.FlushPendingInstances();f.Reset(null);a&&(this._perfRecord.totalTimeCounter+=performance.now()-d)}}*DebugRun(){if(!this._hasRun){this._hasRun=!0;var b=this._runtime,a=this.GetEventSheetManager(),d=a.GetCurrentEventStackFrame();for(const c of this._events)yield*c.DebugRun(d),a.ClearSol(c.GetSolModifiers()),a.ClearAsyncActionPromises(),b.FlushPendingInstances();d.Reset(null)}}_Trigger(b,
a,d){if(a){const c=a.GetObjectClass();this._TriggerForClass(b,a,c,d);for(const f of c.GetFamilies())this._TriggerForClass(b,a,f,d)}else return this._TriggerForClass(b,a,null,null)}_TriggerForClass(b,a,d,c){d=this._triggers.get(d);if(!d)return!1;c=c?d.behaviors.get(c):d.methodMap;if(!c)return!1;c=c.get(b);if(!c)return!1;b=!1;for(const [f,h]of c)c=this._ExecuteTrigger(a,f,h),b=b||c;return b}*_DebugTrigger(b,a,d){if(a){const c=a.GetObjectClass();yield*this._DebugTriggerForClass(b,a,c,d);for(const f of c.GetFamilies())yield*this._DebugTriggerForClass(b,
a,f,d)}else return yield*this._DebugTriggerForClass(b,a,null,null)}*_DebugTriggerForClass(b,a,d,c){d=this._triggers.get(d);if(!d)return!1;c=c?d.behaviors.get(c):d.methodMap;if(!c)return!1;c=c.get(b);if(!c)return!1;b=!1;for(const [f,h]of c)c=f.DebugCanRunFast()?this._ExecuteTrigger(a,f,h):yield*this._DebugExecuteTrigger(a,f,h),b=b||c;return b}_FastTrigger(b,a,d){a=a.GetObjectClass();a=this._fastTriggers.get(a);if(!a)return!1;b=a.get(b);if(!b)return!1;d=b.get(d);if(!d)return!1;b=!1;for(let c=0,f=d.length;c<
f;++c)a=d[c],a=this._ExecuteTrigger(null,a[0],a[1]),b=b||a;return b}*_DebugFastTrigger(b,a,d){a=a.GetObjectClass();a=this._fastTriggers.get(a);if(!a)return!1;b=a.get(b);if(!b)return!1;d=b.get(d);if(!d)return!1;b=!1;for(let f=0,h=d.length;f<h;++f){var c=d[f];a=c[0];c=c[1];a=a.DebugCanRunFast()?this._ExecuteTrigger(null,a,c):yield*this._DebugExecuteTrigger(null,a,c);b=b||a}return b}_ExecuteTrigger(b,a,d){const c=this._runtime,f=this._eventSheetManager,h=f.GetCurrentEvent(),g=f.GetEventStack(),l=f.GetTriggerDepth();
let m=!1;h&&f.PushCleanSol(h.GetSolModifiersIncludingParents());f.PushCleanSol(a.GetSolModifiersIncludingParents());const u=1<l;u&&f.GetLocalVarStack().Push();const w=g.Push(a);b&&(a.GetConditions()[d].GetObjectClass().GetCurrentSol().SetSinglePicked(b),b.IsInContainer()&&b.SetSiblingsSinglePicked());b=!0;if(a.GetParent()){const q=a.GetTriggerParents();for(let t=0,p=q.length;t<p;++t)if(!q[t].RunPreTrigger(w)){b=!1;break}}b&&(c.IncrementExecCount(),a.IsOrBlock()?a.RunOrBlockTrigger(w,d):a.Run(w),m=
w.GetLastEventTrue());g.Pop();u&&f.GetLocalVarStack().Pop();f.PopSol(a.GetSolModifiersIncludingParents());h&&f.PopSol(h.GetSolModifiersIncludingParents());h||1!==l||(f.ClearAsyncActionPromises(),f.IsFlushingBlocked()||c.FlushPendingInstances());return m}*_DebugExecuteTrigger(b,a,d){const c=this._runtime,f=this._eventSheetManager,h=f.GetCurrentEvent(),g=f.GetEventStack(),l=f.GetTriggerDepth();let m=!1;h&&f.PushCleanSol(h.GetSolModifiersIncludingParents());f.PushCleanSol(a.GetSolModifiersIncludingParents());
const u=1<l;u&&f.GetLocalVarStack().Push();const w=g.Push(a);b&&(a.GetConditions()[d].GetObjectClass().GetCurrentSol().SetSinglePicked(b),b.IsInContainer()&&b.SetSiblingsSinglePicked());b=!0;if(a.GetParent()){const q=a.GetTriggerParents();for(let t=0,p=q.length;t<p;++t)if(!(yield*q[t].DebugRunPreTrigger(w))){b=!1;break}}b&&(c.IncrementExecCount(),a.IsOrBlock()?yield*a.DebugRunOrBlockTrigger(w,d):yield*a.DebugRun(w),m=w.GetLastEventTrue());g.Pop();u&&f.GetLocalVarStack().Pop();f.PopSol(a.GetSolModifiersIncludingParents());
h&&f.PopSol(h.GetSolModifiersIncludingParents());h||1!==l||(f.ClearAsyncActionPromises(),f.IsFlushingBlocked()||c.FlushPendingInstances());return m}_GetPerfRecord(){return this._perfRecord}}}
{"use strict";const e=self.C3,b=[];function a(c,f){return!0}function*d(c,f){return!0}e.EventBlock=class extends e.DefendedBase{constructor(c,f,h){super();this._eventSheet=c;this._runtime=c.GetRuntime();this._parent=f;this._scopeParent=null;this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._solModifiers=[];this._solModifiersIncludingParents=[];this._hasElseBlock=this._isTopLevelGroup=this._isSolWriterAfterCnds=this._hasGotSolModifiersIncludingParents=!1;this._isOrBlock=!!h[2];
this._isElseBlock=!1;this._triggerParents=null;this._conditions=[];this._actions=[];this._subEvents=[];this._RunActions=a;this._DebugRunActions=d;this._isInitiallyActive=this._isGroup=!1;this._groupName="";this._isGroupActive=!1;this._perfRecord=this._containedIncludes=null;this._sid=h[4];this._displayNumber=h[5];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=this._runtime.IsDebug()?{isBreakpoint:h[3][0],isBreakable:h[3][1],canRunAllConditionsFast:!1,canRunAllActionsFast:!1,
canRunAllSubEventsFast:!1,canRunSelfFast:!1}:null;this.GetEventSheetManager()._RegisterEventBlock(this);3===h[0]&&this._InitGroup(h[1]);c=0;for(var g of h[6])f=e.Condition.Create(this,g,c++),this._conditions.push(f),this._AddSolModifier(f.GetObjectClass());c=0;for(const l of h[7])g=e.Action.Create(this,l,c++),this._actions.push(g);if(9===h.length){h=h[8];for(const l of h)this._eventSheet._CreateEvent(l,this,this._subEvents)}this._conditions.length&&(this._isElseBlock=null===this._conditions[0].GetObjectClass()&&
this._conditions[0]._GetFunc()===e.Plugins.System.Cnds.Else);0===this._conditions.length&&(this._conditions=b);0===this._actions.length&&(this._actions=b);0===this._subEvents.length&&(this._subEvents=b)}static Create(c,f,h){return e.New(e.EventBlock,c,f,h)}_InitGroup(c){this._isGroup=!0;this._isGroupActive=this._isInitiallyActive=!!c[0];this._groupName=c[1].toLowerCase();this._containedIncludes=[];this.GetEventSheetManager()._RegisterGroup(this);this._runtime.IsDebug()&&(this._perfRecord={type:"group",
name:c[1],totalTimeCounter:0,children:[]})}_AddContainedInclude(c){this._containedIncludes.push(c)}_AddContainerSolModifierToList(c,f){for(const h of c.GetContainer().objectTypes())f.includes(h)||f.push(h)}_AddSolModifierToList(c,f){if(c)if(f.includes(c)||f.push(c),c.IsFamily())for(const h of c.GetFamilyMembers())h.IsInContainer()&&this._AddContainerSolModifierToList(h,f);else c.IsInContainer()&&this._AddContainerSolModifierToList(c,f)}_AddSolModifier(c){this._AddSolModifierToList(c,this._solModifiers)}_AddParentSolModifier(c){this._AddSolModifierToList(c,
this._solModifiersIncludingParents)}SetAllSolModifiers(){this._solModifiers=this._runtime.GetAllObjectClasses()}_PostInit(c){this._hasElseBlock=!!c;this._IdentifyTopLevelGroup();this._IdentifyTriggerParents();for(const h of this._conditions)h._PostInit();if(0<this._actions.length){c=!1;for(var f of this._actions)f._PostInit(),f.HasReturnType()&&(c=!0);c?(this._RunActions=this._RunActions_ReturnValue,this._DebugRunActions=this._DebugRunActions_ReturnValue):(this._RunActions=this._RunActions_Fast,this._DebugRunActions=
this._DebugRunActions_Fast)}f=this._subEvents;for(let h=0,g=f.length;h<g;++h)c=h<g-1&&f[h+1]instanceof e.EventBlock&&f[h+1].IsElseBlock(),f[h]._PostInit(c);this._debugData&&this._UpdateCanRunFast();this._perfRecord&&this._GetPerfRecordParent()._GetPerfRecord().children.push(this._perfRecord)}_GetPerfRecord(){return this._perfRecord}_GetPerfRecordParent(){let c=this.GetParent();for(;c;){if(c.IsGroup())return c;c=c.GetParent()}return this._eventSheet}_UpdateCanRunFast(){const c=this._debugData;c.canRunAllConditionsFast=
this._conditions.every(f=>f.DebugCanRunFast());c.canRunAllActionsFast=this._actions.every(f=>f.DebugCanRunFast());c.canRunAllSubEventsFast=this._subEvents.every(f=>f.DebugCanRunFast());c.canRunSelfFast=c.canRunAllConditionsFast&&c.canRunAllActionsFast&&c.canRunAllSubEventsFast}_UpdateCanRunFastRecursive(){let c=this;do c._UpdateCanRunFast(),c=c.GetParent();while(c)}_IdentifyTopLevelGroup(){if(this.IsGroup()){var c=this.GetParent();for(this._isTopLevelGroup=!0;c;){if(!c.IsGroup()){this._isTopLevelGroup=
!1;break}c=c.GetParent()}}}_IdentifySolModifiersIncludingParents(){var c=this._runtime.GetAllObjectClasses();if(this._solModifiers===c)this._solModifiersIncludingParents=c;else{this._solModifiersIncludingParents=e.cloneArray(this._solModifiers);for(c=this.GetParent();c;){for(var f of c._solModifiers)this._AddParentSolModifier(f);c=c.GetParent()}f=this.GetEventSheetManager();this._solModifiers=f._DeduplicateSolModifierList(this._solModifiers);this._solModifiersIncludingParents=f._DeduplicateSolModifierList(this._solModifiersIncludingParents)}}_IdentifyTriggerParents(){if(this.HasAnyTriggeredCondition()){this._triggerParents=
[];for(var c=this.GetParent();c;)this._triggerParents.push(c),c=c.GetParent();this._triggerParents.reverse()}}SetSolWriterAfterCnds(){this._isSolWriterAfterCnds=!0;this._parent&&this._parent.SetSolWriterAfterCnds()}IsSolWriterAfterCnds(){return this._isSolWriterAfterCnds}GetSolModifiers(){return this._solModifiers}GetSolModifiersIncludingParents(){this._hasGotSolModifiersIncludingParents||(this._hasGotSolModifiersIncludingParents=!0,this._IdentifySolModifiersIncludingParents());return this._solModifiersIncludingParents}HasSolModifier(c){return this._solModifiers.includes(c)}GetTriggerParents(){return this._triggerParents}GetEventSheet(){return this._eventSheet}GetEventSheetManager(){return this._eventSheet.GetEventSheetManager()}GetRuntime(){return this._runtime}GetParent(){return this._parent}_SetScopeParent(c){this._scopeParent=
c}GetScopeParent(){return this._scopeParent||this._parent}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(c){this._debugData.isBreakpoint=!!c;this._UpdateCanRunFastRecursive()}IsGroup(){return this._isGroup}IsTopLevelGroup(){return this._isTopLevelGroup}IsElseBlock(){return this._isElseBlock}HasElseBlock(){return this._hasElseBlock}GetGroupName(){return this._groupName}IsGroupActive(){return this._isGroupActive}ResetInitialActivation(){this.SetGroupActive(this._isInitiallyActive)}SetGroupActive(c){c=
!!c;if(!this._isGroup)throw Error("not a group");if(this._isGroupActive!==c){this._isGroupActive=c;for(const f of this._containedIncludes)f.UpdateActive();this._containedIncludes.length&&(c=this._runtime.GetCurrentLayout().GetEventSheet())&&c._UpdateDeepIncludes()}}GetSID(){return this._sid}IsOrBlock(){return this._isOrBlock}IsTrigger(){return this._conditions.length&&this._conditions[0].IsTrigger()}IsForFunctionBlock(){return this._scopeParent&&this._scopeParent instanceof e.FunctionBlock}HasAnyTriggeredCondition(){return this.IsForFunctionBlock()||
this._conditions.some(c=>c.IsTrigger())}GetConditions(){return this._conditions}GetConditionCount(){return this._conditions.length}GetConditionAt(c){c=Math.floor(c);if(0>c||c>=this._conditions.length)throw new RangeError("invalid condition index");return this._conditions[c]}GetConditionByDebugIndex(c){return this.GetConditionAt(c)}IsFirstConditionOfType(c){let f=c.GetIndex();if(0===f)return!0;for(--f;0<=f;--f)if(this._conditions[f].GetObjectClass()===c.GetObjectClass())return!1;return!0}GetActions(){return this._actions}GetActionCount(){return this._actions.length}GetActionAt(c){c=
Math.floor(c);if(0>c||c>=this._actions.length)throw new RangeError("invalid action index");return this._actions[c]}GetActionByDebugIndex(c){c=Math.floor(c);const f=this._actions.find(h=>h.GetDebugIndex()===c);if(!f)throw new RangeError("invalid action debug index");return f}_HasActionIndex(c){c=Math.floor(c);return 0<=c&&c<this._actions.length}GetSubEvents(){return this._subEvents}_GetAllLocalVariablesInScope(){return this._subEvents.filter(c=>c instanceof e.EventVariable)}RunPreTrigger(c){c.SetCurrentEvent(this);
let f=!1;const h=this._conditions;for(let g=0,l=h.length;g<l;++g){const m=h[g];c.SetConditionIndex(g);if(m.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(m.Run())f=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?f:!0}RunOrBlockTrigger(c,f){c.SetCurrentEvent(this);this._conditions[f].Run()&&(this._RunActions(c,0)&&this._RunSubEvents(c),c.SetLastEventTrue(!0))}*DebugRunPreTrigger(c){c.SetCurrentEvent(this);let f=!1;const h=this._conditions;for(let g=0,l=h.length;g<
l;++g){const m=h[g];c.SetConditionIndex(g);if(m.IsLooping())throw Error("trigger cannot be used as sub-event to a loop");if(m.DebugCanRunFast()?m.Run():yield*m.DebugRun())f=!0;else if(!this._isOrBlock)return!1}return this._isOrBlock?f:!0}*DebugRunOrBlockTrigger(c,f){c.SetCurrentEvent(this);f=this._conditions[f];if(f.DebugCanRunFast()?f.Run():yield*f.DebugRun())(this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():
yield*this._DebugRunSubEvents()),c.SetLastEventTrue(!0)}Run(c){c.SetCurrentEvent(this);this._isElseBlock||c.SetElseBranchRan(!1);this._isOrBlock?this._RunOrBlock(c):this._RunAndBlock(c)}*DebugRun(c){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;c.SetCurrentEvent(this);this._isElseBlock||c.SetElseBranchRan(!1);this._isOrBlock?yield*this._DebugRunOrBlock(c):yield*this._DebugRunAndBlock(c)}_RunOrBlock(c){const f=this._conditions;let h=0===f.length;for(let l=0,m=f.length;l<m;++l){var g=
f[l];g.IsTrigger()||(c.SetConditionIndex(l),g=g.Run(),h=h||g)}c.SetLastEventTrue(h);h&&(this._RunActions(c,0)&&this._RunSubEvents(c),this._hasElseBlock&&c.SetElseBranchRan(!0))}*_DebugRunOrBlock(c){const f=this._conditions;let h=0===f.length;for(let l=0,m=f.length;l<m;++l){var g=f[l];g.IsTrigger()||(c.SetConditionIndex(l),g=g.DebugCanRunFast()?g.Run():yield*g.DebugRun(),h=h||g)}c.SetLastEventTrue(h);h&&((this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?
this._RunSubEvents():yield*this._DebugRunSubEvents()),this._hasElseBlock&&c.SetElseBranchRan(!0))}_RunAndBlock(c){const f=this._conditions;for(let h=0,g=f.length;h<g;++h){const l=f[h];c.SetConditionIndex(h);if(!l.Run()){c.SetLastEventTrue(!1);return}}c.SetLastEventTrue(!0);this._RunActions(c,0)&&this._RunSubEvents(c);c.GetLastEventTrue()&&this._hasElseBlock&&c.SetElseBranchRan(!0)}*_DebugRunAndBlock(c){const f=this._conditions;for(let h=0,g=f.length;h<g;++h){const l=f[h];c.SetConditionIndex(h);if(l.DebugCanRunFast()?
!l.Run():!(yield*l.DebugRun())){c.SetLastEventTrue(!1);return}}c.SetLastEventTrue(!0);(this.DebugCanRunActionsFast()?this._RunActions(c,0):yield*this._DebugRunActions(c,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());c.GetLastEventTrue()&&this._hasElseBlock&&c.SetElseBranchRan(!0)}_RunActions_Fast(c,f){const h=this._actions;for(let g=f,l=h.length;g<l;++g)f=h[g],c.SetActionIndex(g),f.Run();return!0}*_DebugRunActions_Fast(c,f){const h=this._actions;for(let g=
f,l=h.length;g<l;++g)f=h[g],c.SetActionIndex(g),f.DebugCanRunFast()?f.Run():yield*f.DebugRun();return!0}_RunActions_ReturnValue(c,f){const h=this.GetEventSheetManager(),g=this._actions;for(let l=f,m=g.length;l<m;++l){f=g[l];c.SetActionIndex(l);const u=f.Run();if(f.CanBailOut()&&!0===u)return!1;f.IsAsync()&&u instanceof Promise&&h.AddAsyncActionPromise(u)}return!0}*_DebugRunActions_ReturnValue(c,f){const h=this.GetEventSheetManager(),g=this._actions;for(let l=f,m=g.length;l<m;++l){f=g[l];c.SetActionIndex(l);
let u;u=f.DebugCanRunFast()?f.Run():yield*f.DebugRun();if(f.CanBailOut()&&!0===u)return!1;f.IsAsync()&&u instanceof Promise&&h.AddAsyncActionPromise(u)}return!0}_ResumeActionsAndSubEvents(c){this._RunActions(c,c.GetActionIndex())&&this._RunSubEvents()}*_DebugResumeActionsAndSubEvents(c){if(yield*this._DebugRunActions(c,c.GetActionIndex()))yield*this._DebugRunSubEvents()}_RunSubEvents(){if(this._subEvents.length){var c=this.IsGroup()&&this._runtime.IsCPUProfiling(),f=c?performance.now():0,h=this._eventStack,
g=h.Push(this);this._isSolWriterAfterCnds?this._RunSubEvents_SolWriterAfterCnds(g):this._RunSubEvents_Fast(g);h.Pop();c&&(this._perfRecord.totalTimeCounter+=performance.now()-f)}}_RunSubEvents_SolWriterAfterCnds(c){const f=this._isGroup,h=this._isTopLevelGroup,g=this.GetEventSheetManager(),l=this._subEvents;for(let m=0,u=l.length,w=u-1;m<u;++m){const q=l[m],t=q.GetSolModifiers(),p=!h||!f&&m<w;p&&g.PushCopySol(t);q.Run(c);p?g.PopSol(t):g.ClearSol(t)}}_RunSubEvents_Fast(c){const f=this._subEvents;for(let h=
0,g=f.length;h<g;++h)f[h].Run(c)}*_DebugRunSubEvents(){if(this._subEvents.length){var c=this._eventStack,f=c.Push(this);this._isSolWriterAfterCnds?yield*this._DebugRunSubEvents_SolWriterAfterCnds(f):yield*this._DebugRunSubEvents_Fast(f);c.Pop()}}*_DebugRunSubEvents_SolWriterAfterCnds(c){const f=this._isGroup,h=this._isTopLevelGroup,g=this.GetEventSheetManager(),l=this._subEvents;for(let m=0,u=l.length,w=u-1;m<u;++m){const q=l[m],t=q.GetSolModifiers(),p=!h||!f&&m<w;p&&g.PushCopySol(t);yield*q.DebugRun(c);
p?g.PopSol(t):g.ClearSol(t)}}*_DebugRunSubEvents_Fast(c){const f=this._subEvents;for(let h=0,g=f.length;h<g;++h)yield*f[h].DebugRun(c)}Retrigger(c,f){this._runtime.IncrementExecCount();f.ResetQuick();const h=this._conditions;if(!this.IsOrBlock())for(let g=c.GetConditionIndex()+1,l=h.length;g<l;++g)if(c=h[g],f.SetConditionIndex(g),!c.Run())return!1;this._RunActions(f,0)&&this._RunSubEvents(f);return!0}*DebugRetrigger(c,f){this._runtime.IncrementExecCount();f.ResetQuick();const h=this._conditions;if(!this.IsOrBlock())for(let g=
c.GetConditionIndex()+1,l=h.length;g<l;++g)if(c=h[g],f.SetConditionIndex(g),c.DebugCanRunFast()?!c.Run():!(yield*c.DebugRun()))return!1;(this.DebugCanRunActionsFast()?this._RunActions(f,0):yield*this._DebugRunActions(f,0))&&(this.DebugCanRunSubEventsFast()?this._RunSubEvents():yield*this._DebugRunSubEvents());return!0}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()&&this._debugData.canRunSelfFast}DebugCanRunActionsFast(){return!this._runtime.DebugBreakNext()&&this._debugData.canRunAllActionsFast}DebugCanRunSubEventsFast(){return!this._runtime.DebugBreakNext()&&
this._debugData.canRunAllSubEventsFast}_CheckParentsOKToRun(c){if(this.GetParent()){const f=this.GetTriggerParents();for(let h=0,g=f.length;h<g;++h)if(!f[h].RunPreTrigger(c))return!1}return!0}*_DebugCheckParentsOKToRun(c){if(this.GetParent()){const f=this.GetTriggerParents();for(let h=0,g=f.length;h<g;++h)if(!(yield*f[h].DebugRunPreTrigger(c)))return!1}return!0}_EvaluateFunctionCallParameters(c,f,h){0<f.length?h?(f=f.map(g=>g.Get(0)),c.GetLocalVarStack().Push(),this._scopeParent.SetFunctionParameters(f)):
this._scopeParent.EvaluateFunctionParameters(f):h&&c.GetLocalVarStack().Push()}RunAsFunctionCall(c,f){let h,g;const l=0<c.length;var m=this._runtime;const u=this._eventStack,w=m.GetEventSheetManager(),q=1<w._IncTriggerDepth();this._EvaluateFunctionCallParameters(w,f,q);l&&w.PushCleanSol(c);f=u.Push(this);this._CheckParentsOKToRun(f)&&(m.IncrementExecCount(),f.SetCurrentEvent(this),(m=this._scopeParent.IsAsync())&&([g,h]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(f),m&&this._scopeParent.MaybeFinishAsyncFunctionCall(g));
u.Pop();q&&w.GetLocalVarStack().Pop();l&&w.PopSol(c);w._DecTriggerDepth();return h}*DebugRunAsFunctionCall(c,f){let h,g;if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const l=0<c.length;var m=this._runtime;const u=this._eventStack,w=m.GetEventSheetManager(),q=1<w._IncTriggerDepth();this._EvaluateFunctionCallParameters(w,f,q);l&&w.PushCleanSol(c);f=u.Push(this);if(yield*this._DebugCheckParentsOKToRun(f))m.IncrementExecCount(),f.SetCurrentEvent(this),(m=this._scopeParent.IsAsync())&&
([g,h]=this._scopeParent.StartAsyncFunctionCall()),yield*this._DebugRunAndBlock(f),m&&this._scopeParent.MaybeFinishAsyncFunctionCall(g);u.Pop();q&&w.GetLocalVarStack().Pop();l&&w.PopSol(c);w._DecTriggerDepth();return h}RunAsMappedFunctionCall(c){const f=this.GetSolModifiersIncludingParents(),h=0<f.length,g=this._runtime,l=this._eventStack,m=g.GetEventSheetManager(),u=1<m._IncTriggerDepth();u&&m.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(c);h&&m.PushCleanSol(f);c=l.Push(this);
this._CheckParentsOKToRun(c)&&(g.IncrementExecCount(),c.SetCurrentEvent(this),this._RunAndBlock(c));l.Pop();u&&m.GetLocalVarStack().Pop();h&&m.PopSol(f);m._DecTriggerDepth()}*DebugRunAsMappedFunctionCall(c){if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;const f=this.GetSolModifiersIncludingParents(),h=0<f.length,g=this._runtime,l=this._eventStack,m=g.GetEventSheetManager(),u=1<m._IncTriggerDepth();u&&m.GetLocalVarStack().Push();this._scopeParent.SetFunctionParameters(c);h&&
m.PushCleanSol(f);c=l.Push(this);if(yield*this._DebugCheckParentsOKToRun(c))g.IncrementExecCount(),c.SetCurrentEvent(this),yield*this._DebugRunAndBlock(c);l.Pop();u&&m.GetLocalVarStack().Pop();h&&m.PopSol(f);m._DecTriggerDepth()}RunAsExpressionFunctionCall(c,f,h,...g){let l,m;const u=0<c.length,w=this._runtime,q=this._eventStack,t=w.GetEventSheetManager(),p=1<t._IncTriggerDepth();p&&t.GetLocalVarStack().Push();0<g.length&&this._scopeParent.SetFunctionParameters(g);u&&t.PushCleanSol(c);g=q.Push(this);
g.InitCallFunctionExpression(f,h);q.PushExpFunc(g);w.SetDebuggingEnabled(!1);this._CheckParentsOKToRun(g)&&(w.IncrementExecCount(),g.SetCurrentEvent(this),(f=this._scopeParent.IsAsync())&&([m,l]=this._scopeParent.StartAsyncFunctionCall()),this._RunAndBlock(g),f&&this._scopeParent.MaybeFinishAsyncFunctionCall(m));w.SetDebuggingEnabled(!0);q.Pop();q.PopExpFunc();p&&t.GetLocalVarStack().Pop();u&&t.PopSol(c);t._DecTriggerDepth();return l||g.GetFunctionReturnValue()}}}
{"use strict";const e=self.C3,b=[];let a=!1;e.EventScript=class extends e.DefendedBase{constructor(d,c,f){super();const h=d.GetRuntime(),g=d.GetEventSheetManager();this._eventSheet=d;this._eventSheetManager=g;this._runtime=d.GetRuntime();this._parent=c;this._func=h.GetObjectReference(f[1]);this._displayNumber=f[2];this._eventSheet._RegisterEventByDisplayNumber(this,this._displayNumber);this._debugData=h.IsDebug()?{isBreakpoint:f[3][0],isBreakable:f[3][1]}:null}static Create(d,c,f){return e.New(e.EventScript,
d,c,f)}_PostInit(){const d=this._func,c=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this);this._func=d.bind(null,this._runtime.GetIRuntime(),c)}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetEventSheet(){return this._eventSheet}GetDisplayNumber(){return this._displayNumber}IsDebugBreakable(){return this._debugData&&this._debugData.isBreakable}IsDebugBreakpoint(){return this.IsDebugBreakable()&&this._debugData.isBreakpoint}_SetDebugBreakpoint(d){this._debugData.isBreakpoint=
!!d}IsElseBlock(){return!1}GetSolModifiers(){return b}GetSolModifiersIncludingParents(){return this._parent?this._parent.GetSolModifiersIncludingParents():b}Run(d){d.SetCurrentEvent(this);this._eventSheetManager.AddAsyncActionPromise(this._RunUserScript())}async _RunUserScript(){try{await this._func()}catch(d){console.error(`Unhandled exception running script %c${this.GetEventSheet().GetName()}, event ${this.GetDisplayNumber()}:`,"font-size: 1.2em; font-weight: bold;",d),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),
a||(console.info("%cTip:%c run this to highlight in Construct the last script that had an error: %cgoToLastErrorScript()","font-weight: bold; text-decoration: underline","","font-weight: bold"),a=!0)}}*DebugRun(d){d.SetCurrentEvent(this);if(this.IsDebugBreakpoint()||this._runtime.DebugBreakNext())yield this;this.Run(d)}DebugCanRunFast(){return!this.IsDebugBreakpoint()&&!this._runtime.DebugBreakNext()}static HadUserScriptException(){return a}static SetHadUserScriptException(){a=!0}}}
{"use strict";const e=self.C3;e.FunctionBlock=class extends e.DefendedBase{constructor(b,a,d){super();this._eventSheet=b;this._runtime=b.GetRuntime();this._parent=a;const c=d[1];this._functionName=c[0];this._returnType=c[1];this._functionParameters=c[2].map(f=>e.EventVariable.Create(b,this,f));this._isEnabled=c[3];this._innerLocalVariables=[];this._isAsync=c[4];this._nextAsyncId=0;this._currentAsyncId=-1;this._asyncMap=new Map;this._eventBlock=e.EventBlock.Create(b,a,d);this._eventBlock._SetScopeParent(this)}static Create(b,
a,d){return e.New(e.FunctionBlock,b,a,d)}_PostInit(){for(const b of this._functionParameters)b._PostInit();this._eventBlock._PostInit(!1)}_GetAllLocalVariablesInScope(){return this._functionParameters}GetFunctionParameters(){return this._functionParameters}GetFunctionParameterCount(){return this._functionParameters.length}_RegisterLocalVariable(b){this._innerLocalVariables.push(b)}_GetAllInnerLocalVariables(){return this._innerLocalVariables}EvaluateFunctionParameters(b){const a=this._functionParameters;
for(let d=0,c=a.length;d<c;++d)a[d].SetValue(b[d].Get(0))}SetFunctionParameters(b){const a=this._functionParameters;for(let d=0,c=a.length;d<c;++d)a[d].SetValue(b[d])}CaptureFunctionParameters(){return this._functionParameters.map(b=>b.GetValue())}GetParent(){return this._parent}GetScopeParent(){return this._parent}GetFunctionName(){return this._functionName}GetReturnType(){return this._returnType}IsEnabled(){return this._isEnabled}GetDefaultReturnValue(){switch(this._returnType){case 0:return null;
case 2:return"";default:return 0}}GetEventBlock(){return this._eventBlock}IsAsync(){return this._isAsync}StartAsyncFunctionCall(){const b=this._nextAsyncId++;this._currentAsyncId=b;let a;const d=new Promise(c=>a=c);this._asyncMap.set(b,{resolve:a,pauseCount:0});return[b,d]}MaybeFinishAsyncFunctionCall(b){const a=this._asyncMap.get(b);0===a.pauseCount&&(a.resolve(),this._asyncMap.delete(b));this._currentAsyncId=-1}PauseCurrentAsyncFunction(){this._asyncMap.get(this._currentAsyncId).pauseCount++;return this._currentAsyncId}ResumeAsyncFunction(b){this._currentAsyncId=
b;this._asyncMap.get(b).pauseCount--}}}
{"use strict";const e=self.C3,b=[];e.EventVariable=class extends e.DefendedBase{constructor(a,d,c){super();const f=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=f;this._runtime=a.GetRuntime();this._parent=d;this._localVarStack=f.GetLocalVarStack();this._name=c[1];this._type=c[2];this._initialValue=c[3];this._isStatic=!!c[4];this._isConstant=!!c[5];this._isFunctionParameter=d instanceof e.FunctionBlock;this._sid=c[6];this._jsPropName=this._runtime.GetJsPropName(c[8]);this._scriptSetter=
h=>this.SetValue(h);this._scriptGetter=()=>this.GetValue();this._hasSingleValue=!this._parent||this._isStatic||this._isConstant;this._value=this._initialValue;this._localIndex=-1;this.IsBoolean()&&(this._value=this._value?1:0);!this.IsLocal()||this.IsStatic()||this.IsConstant()||(this._localIndex=f._GetNextLocalVarIndex(this));f._RegisterEventVariable(this)}static Create(a,d,c){return e.New(e.EventVariable,a,d,c)}_PostInit(){if(this.IsLocal()&&!this.IsStatic()&&!this.IsConstant()&&!this.IsFunctionParameter()){const a=
this._eventSheetManager.FindFirstFunctionBlockParent(this);a&&a._RegisterLocalVariable(this)}}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetParent(){return this._parent}GetScopeParent(){return this.GetParent()}IsGlobal(){return!this.GetParent()}IsLocal(){return!this.IsGlobal()}IsFunctionParameter(){return this._isFunctionParameter}IsStatic(){return this._isStatic}IsConstant(){return this._isConstant}IsNumber(){return 0===this._type}IsString(){return 1===this._type}IsBoolean(){return 2===
this._type}IsElseBlock(){return!1}GetSID(){return this._sid}GetInitialValue(){return this._initialValue}GetSolModifiers(){return b}Run(a){!this.IsLocal()||this.IsStatic()||this.IsConstant()||this.SetValue(this.GetInitialValue())}DebugCanRunFast(){return!0}*DebugRun(a){this.Run(a)}SetValue(a){this.IsNumber()?"number"!==typeof a&&(a=parseFloat(a)):this.IsString()?"string"!==typeof a&&(a=a.toString()):this.IsBoolean()&&(a=a?1:0);this._hasSingleValue?this._value=a:this._localVarStack.GetCurrent()[this._localIndex]=
a}GetValue(){return this._hasSingleValue?this._value:this._localVarStack.GetCurrent()[this._localIndex]}GetTypedValue(){let a=this.GetValue();this.IsBoolean()&&(a=!!a);return a}ResetToInitialValue(){this._value=this._initialValue}_GetScriptInterfaceDescriptor(){return{configurable:!1,enumerable:!0,get:this._scriptGetter,set:this._scriptSetter}}}}
{"use strict";const e=self.C3,b=[];e.EventInclude=class extends e.DefendedBase{constructor(a,d,c){super();const f=a.GetEventSheetManager();this._eventSheet=a;this._eventSheetManager=f;this._runtime=a.GetRuntime();this._parent=d;this._includeSheet=null;this._includeSheetName=c[1];this._isActive=!0}static Create(a,d,c){return e.New(e.EventInclude,a,d,c)}_PostInit(){this._includeSheet=this._eventSheetManager.GetEventSheetByName(this._includeSheetName);this._eventSheet._AddShallowInclude(this);let a=
this.GetParent();for(;a;)a instanceof e.EventBlock&&a.IsGroup()&&a._AddContainedInclude(this),a=a.GetParent();this.UpdateActive();this._runtime.IsDebug()&&this._eventSheet._GetPerfRecord().children.push(this._includeSheet._GetPerfRecord())}GetParent(){return this._parent}GetSolModifiers(){return b}GetIncludeSheet(){return this._includeSheet}Run(a){a=!!this.GetParent();const d=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(d);this._includeSheet.Run();a&&this._eventSheetManager.PopSol(d)}*DebugRun(a){a=
!!this.GetParent();const d=this._runtime.GetAllObjectClasses();a&&this._eventSheetManager.PushCleanSol(d);yield*this._includeSheet.DebugRun();a&&this._eventSheetManager.PopSol(d)}DebugCanRunFast(){return!1}IsActive(){return this._isActive}UpdateActive(){let a=this.GetParent();for(;a;){if(a instanceof e.EventBlock&&a.IsGroup()&&!a.IsGroupActive()){this._isActive=!1;return}a=a.GetParent()}this._isActive=!0}}}
{"use strict";const e=self.C3;e.ExpNode=class extends e.DefendedBase{constructor(l){super();this._owner=l;this._runtime=l.GetRuntime()}_PostInit(){}static CreateNode(l,m){return e.New([h,c,f,g,b,a][m[0]],l,m)}};class b extends e.ExpNode{constructor(l,m){super(l);this._systemPlugin=this._runtime.GetSystemPlugin();this._func=this._runtime.GetObjectReference(m[1]);this._func!==e.Plugins.System.Exps.random&&this._func!==e.Plugins.System.Exps.choose||this._owner.SetVariesPerInstance()}GetBoundMethod(){return this._systemPlugin._GetBoundACEMethod(this._func,
this._systemPlugin)}}class a extends e.ExpNode{constructor(l,m){super(l);this._functionBlock=null;this._functionName=m[1];this._owner.SetVariesPerInstance()}_PostInit(){const l=this._runtime.GetEventSheetManager();this._functionBlock=l.GetFunctionBlockByName(this._functionName);this._functionName=null;const m=this._owner.GetEventBlock(),u=this._functionBlock.GetEventBlock();this._combinedSolModifiers=[...new Set([...m.GetSolModifiersIncludingParents(),...u.GetSolModifiersIncludingParents()])];this._combinedSolModifiers=
l._DeduplicateSolModifierList(this._combinedSolModifiers)}GetBoundMethod(){const l=this._functionBlock;if(l.IsEnabled()){const m=l.GetEventBlock();return e.EventBlock.prototype.RunAsExpressionFunctionCall.bind(m,this._combinedSolModifiers,l.GetReturnType(),l.GetDefaultReturnValue())}{const m=l.GetDefaultReturnValue();return()=>m}}}function d(l,m){if(l>=m)return l%m;0>l&&(l<=-m&&(l%=m),0>l&&(l+=m));return l}class c extends e.ExpNode{constructor(l,m){super(l);this._objectClass=this._runtime.GetObjectClassByIndex(m[1]);
this._func=this._runtime.GetObjectReference(m[2]);this._returnsString=!!m[3];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}GetBoundMethod(){return this._objectClass.GetPlugin()._GetBoundACEMethod(this._func,this._objectClass.GetSingleGlobalInstance().GetSdkInstance())}ExpObject(...l){const m=this._objectClass,u=m.GetCurrentSol().GetExpressionInstances();var w=u.length;if(0===w)return this._returnsString?"":0;w=d(this._owner.GetSolIndex(),
w);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m);return this._func.apply(u[w].GetSdkInstance(),l)}ExpObject_InstExpr(l,...m){const u=this._objectClass,w=u.GetInstances(),q=w.length;if(0===q)return this._returnsString?"":0;l=d(l,q);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(u);return this._func.apply(w[l].GetSdkInstance(),m)}}class f extends e.ExpNode{constructor(l,m){super(l);this._objectClass=this._runtime.GetObjectClassByIndex(m[1]);this._varIndex=m[3];
this._returnsString=!!m[2];this._owner._MaybeVaryFor(this._objectClass)}ExpInstVar(){const l=this._objectClass.GetCurrentSol().GetExpressionInstances();var m=l.length;if(0===m)return this._returnsString?"":0;m=d(this._owner.GetSolIndex(),m);return l[m]._GetInstanceVariableValueUnchecked(this._varIndex)}ExpInstVar_Family(){var l=this._objectClass,m=l.GetCurrentSol().GetExpressionInstances(),u=m.length;if(0===u)return this._returnsString?"":0;u=d(this._owner.GetSolIndex(),u);m=m[u];l=m.GetObjectClass().GetFamilyInstanceVariableOffset(l.GetFamilyIndex());
return m._GetInstanceVariableValueUnchecked(this._varIndex+l)}ExpInstVar_InstExpr(l){const m=this._objectClass;var u=m.GetInstances();const w=u.length;if(0===w)return this._returnsString?"":0;l=d(l,w);u=u[l];l=0;m.IsFamily()&&(l=u.GetObjectClass().GetFamilyInstanceVariableOffset(m.GetFamilyIndex()));return u._GetInstanceVariableValueUnchecked(this._varIndex+l)}}class h extends e.ExpNode{constructor(l,m){super(l);this._objectClass=this._runtime.GetObjectClassByIndex(m[1]);this._behaviorType=this._objectClass.GetBehaviorTypeByName(m[2]);
this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(m[2]);this._func=this._runtime.GetObjectReference(m[3]);this._returnsString=!!m[4];this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._owner._MaybeVaryFor(this._objectClass)}ExpBehavior(...l){const m=this._objectClass;var u=m.GetCurrentSol().GetExpressionInstances(),w=u.length;if(0===w)return this._returnsString?"":0;w=d(this._owner.GetSolIndex(),w);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(m);
u=u[w];w=0;m.IsFamily()&&(w=u.GetObjectClass().GetFamilyBehaviorOffset(m.GetFamilyIndex()));return this._func.apply(u.GetBehaviorInstances()[this._behaviorIndex+w].GetSdkInstance(),l)}ExpBehavior_InstExpr(l,...m){const u=this._objectClass;var w=u.GetInstances();const q=w.length;if(0===q)return this._returnsString?"":0;l=d(l,q);this._eventStack.GetCurrentStackFrame().SetExpressionObjectClass(u);w=w[l];l=0;u.IsFamily()&&(l=w.GetObjectClass().GetFamilyBehaviorOffset(u.GetFamilyIndex()));return this._func.apply(w.GetBehaviorInstances()[this._behaviorIndex+
l].GetSdkInstance(),m)}}class g extends e.ExpNode{constructor(l,m){super(l);this._eventVar=null;this._eventVarSid=m[1]}_PostInit(){this._eventVar=this._runtime.GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetVar(){return this._eventVar}}}
{"use strict";const e=self.C3;e.Parameter=class extends e.DefendedBase{constructor(y,D,G){super();this._owner=y;this._index=G;this._type=D;this.Get=null;this._isConstant=this._variesPerInstance=!1}static Create(y,D,G){const A=D[0];return e.New([a,d,u,f,g,c,l,a,f,f,w,q,u,p,d,m,h,t,r,x][A],y,A,G,D)}_PostInit(){}SetVariesPerInstance(){this._variesPerInstance=!0}_MaybeVaryFor(y){this._variesPerInstance||!y||y.GetPlugin().IsSingleGlobal()||(this._variesPerInstance=!0)}VariesPerInstance(){return this._variesPerInstance}GetIndex(){return this._index}GetRuntime(){return this._owner.GetRuntime()}GetEventBlock(){return this._owner.GetEventBlock()}IsConstant(){return this._isConstant}};
function b(y){y=self.C3_ExpressionFuncs[y];if(!y)throw Error("invalid expression number");return y}class a extends e.Parameter{constructor(y,D,G,A){super(y,D,G);this._solIndex=0;y=A[1];this._expressionNumber=y[0];this._numberedNodes=[];this._expressionFunc=null;for(let F=1,J=y.length;F<J;++F)this._numberedNodes.push(e.ExpNode.CreateNode(this,y[F]));this._numberedNodes.length?this.Get=this.GetExpression:(this.Get=b(this._expressionNumber),this._isConstant=!0)}_GetNode(y){if(0>y||y>=this._numberedNodes.length)throw new RangeError("invalid numbered node");
return this._numberedNodes[y]}_PostInit(){for(var y of this._numberedNodes)y._PostInit();y=b(this._expressionNumber);this._expressionFunc=this._numberedNodes.length?y(this):y}GetSolIndex(){return this._solIndex}GetExpression(y){this._solIndex=y;return this._expressionFunc()}}class d extends a{constructor(y,D,G,A){super(y,D,G,A);this.Get=this.GetStringExpression;14===D&&(this.GetEventBlock().SetAllSolModifiers(),this._owner instanceof e.Action&&this.GetEventBlock().SetSolWriterAfterCnds())}GetStringExpression(y){this._solIndex=
y;y=this._expressionFunc();return"string"===typeof y?y:""}_GetFastTriggerValue(){return b(this._expressionNumber)()}}class c extends a{constructor(y,D,G,A){super(y,D,G,A);this.Get=this.GetLayer;this._isConstant=!1}GetLayer(y){this._solIndex=y;y=this._expressionFunc();return this.GetRuntime().GetCurrentLayout().GetLayer(y)}}class f extends e.Parameter{constructor(y,D,G,A){super(y,D,G);this._combo=A[1];this.Get=this.GetCombo;this._isConstant=!0}GetCombo(){return this._combo}}class h extends e.Parameter{constructor(y,
D,G,A){super(y,D,G);this._bool=A[1];this.Get=this.GetBoolean;this._isConstant=!0}GetBoolean(){return this._bool}}class g extends e.Parameter{constructor(y,D,G,A){super(y,D,G);this._objectClass=this.GetRuntime().GetObjectClassByIndex(A[1]);this.Get=this.GetObjectClass;y=this.GetEventBlock();y._AddSolModifier(this._objectClass);this._owner instanceof e.Action?y.SetSolWriterAfterCnds():y.GetParent()&&y.GetParent().SetSolWriterAfterCnds();this._isConstant=!0}GetObjectClass(){return this._objectClass}}
class l extends e.Parameter{constructor(y,D,G,A){super(y,D,G);this._layout=this.GetRuntime().GetLayoutManager().GetLayoutByName(A[1]);this.Get=this.GetLayout;this._isConstant=!0}GetLayout(){return this._layout}}class m extends e.Parameter{constructor(y,D,G,A){super(y,D,G);this._timeline=this.GetRuntime().GetTimelineManager().GetTimelineByName(A[1]);this.Get=this.GetTimeline;this._isConstant=!0}GetTimeline(){return this._timeline}}class u extends e.Parameter{constructor(y,D,G,A){super(y,D,G);this._fileInfo=
A[1];this.Get=this.GetFile;this._isConstant=!0}GetFile(){return this._fileInfo}}class w extends e.Parameter{constructor(y,D,G,A){super(y,D,G);this._instVarIndex=A[1];(y=this._owner.GetObjectClass())&&y.IsFamily()?(this.Get=this.GetFamilyInstanceVariable,this.SetVariesPerInstance()):(this.Get=this.GetInstanceVariable,this._isConstant=!0)}GetInstanceVariable(){return this._instVarIndex}GetFamilyInstanceVariable(y){y=y||0;const D=this._owner.GetObjectClass();var G=D.GetCurrentSol();const A=G.GetInstances();
if(A.length)y=A[y%A.length].GetObjectClass();else if(G.HasAnyElseInstances())G=G.GetElseInstances(),y=G[y%G.length].GetObjectClass();else if(0<D.GetInstanceCount())G=D.GetInstances(),y=G[y%G.length].GetObjectClass();else return 0;return this._instVarIndex+y.GetFamilyInstanceVariableOffset(D.GetFamilyIndex())}}class q extends e.Parameter{constructor(y,D,G,A){super(y,D,G);this._eventVarSid=A[1];this._eventVar=null;this.Get=this.GetEventVariable;this._isConstant=!0}_PostInit(){this._eventVar=this.GetRuntime().GetEventSheetManager().GetEventVariableBySID(this._eventVarSid)}GetEventVariable(){return this._eventVar}}
class t extends e.Parameter{constructor(y,D,G,A){super(y,D,G);this._functionBlockName=A[1];this._functionBlock=null;this.Get=this.GetFunction;this._isConstant=!0}_PostInit(){this._functionBlock=this.GetRuntime().GetEventSheetManager().GetFunctionBlockByName(this._functionBlockName);this._functionBlockName=null}GetFunction(){return this._functionBlock}}class p extends e.Parameter{constructor(y,D,G,A){super(y,D,G);this._subParams=[];this._variadicRet=[];this._isConstant=!0;for(let F=1,J=A.length;F<
J;++F)y=e.Parameter.Create(this._owner,A[F],0),this._subParams.push(y),this._variadicRet.push(0),y.IsConstant()||(this._isConstant=!1);this.Get=this.GetVariadic}_PostInit(){for(const y of this._subParams)y._PostInit()}GetVariadic(){const y=this._subParams,D=this._variadicRet;for(let G=0,A=y.length;G<A;++G)D[G]=y[G].Get(0);return D}}class r extends e.Parameter{constructor(y,D,G,A){super(y,D,G);this._easeIndex=A[1];this.Get=this.GetEase;this._isConstant=!0}GetEase(){return this._easeIndex}}class x extends e.Parameter{constructor(y,
D,G,A){super(y,D,G);this._brushIndex=A[1];this.Get=this.GetTilemapBrush;this._isConstant=!0}GetTilemapBrush(){return this._brushIndex}}}
{"use strict";const e=self.C3;function b(c,f){for(let h=0,g=c.length;h<g;++h)f[h]=c[h].Get(0)}const a=[],d=function(){};e.Condition=class extends e.DefendedBase{constructor(c,f,h){super();this._eventBlock=c;this._runtime=c.GetRuntime();this._index=h;this._func=this._runtime.GetObjectReference(f[1]);this._isTrigger=0<f[3];this._isFastTrigger=2===f[3];this._isLooping=!!f[4];this._isInverted=!!f[5];this._isStatic=!!f[6];this._sid=f[7];this._isInOrBlock=this._eventBlock.IsOrBlock();this._behaviorType=
this._objectClass=null;this._behaviorIndex=-1;this._systemPlugin=null;this.DebugRun=this.Run=d;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;this._debugData=this._runtime.IsDebug()?{isBreakpoint:f[8][0],canDebug:f[8][1]}:null;-1===f[0]?this._systemPlugin=this._runtime.GetSystemPlugin():(this._objectClass=this._runtime.GetObjectClassByIndex(f[0]),f[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(f[2]),this._behaviorIndex=
this._objectClass.GetBehaviorIndexByName(f[2])),this._eventBlock.GetParent()&&this._eventBlock.GetParent().SetSolWriterAfterCnds());if(10===f.length){c=f[9];for(let g of c)this._parameters.push(e.Parameter.Create(this,g,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=a);this._eventBlock.GetEventSheetManager()._RegisterCondition(this)}static Create(c,f,h){return e.New(e.Condition,c,f,h)}_PostInit(){for(const c of this._parameters)c._PostInit(),
c.VariesPerInstance()&&(this._anyParamVariesPerInstance=!0);this._isFastTrigger?(this.Run=this._RunFastTrigger,this.DebugRun=this._DebugRunFastTrigger):this._systemPlugin?(this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this._isStatic?(this.Run=this._RunStatic,this.DebugRun=this._DebugRunStatic):(this.Run=this._RunObject,this.DebugRun=this._DebugRunObject)}_SetSystemRunMethod(){this._SetRunMethodForBoundFunc(this._systemPlugin,
this._systemPlugin,this._RunSystem)}_SetSingleGlobalRunMethod(){const c=this._objectClass.GetPlugin(),f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(c,f,this._RunSingleGlobal)}_SetRunMethodForBoundFunc(c,f,h){const g=this._func,l=this._isInverted,m=this._parameters;if(0===m.length){const u=c._GetBoundACEMethod(g,f);this.Run=l?function(){return e.xor(u(),l)}:u}else if(1===m.length){const u=m[0];if(!l&&u.IsConstant())this.Run=c._GetBoundACEMethod_1param(g,
f,u.Get(0));else{const w=c._GetBoundACEMethod(g,f);this.Run=function(){return e.xor(w(u.Get(0)),l)}}}else if(2===m.length){const u=m[0],w=m[1];if(!l&&u.IsConstant()&&w.IsConstant())this.Run=c._GetBoundACEMethod_2params(g,f,u.Get(0),w.Get(0));else{const q=c._GetBoundACEMethod(g,f);this.Run=function(){return e.xor(q(u.Get(0),w.Get(0)),l)}}}else if(3===m.length){const u=m[0],w=m[1],q=m[2];if(!l&&u.IsConstant()&&w.IsConstant()&&q.IsConstant())this.Run=c._GetBoundACEMethod_3params(g,f,u.Get(0),w.Get(0),
q.Get(0));else{const t=c._GetBoundACEMethod(g,f);this.Run=function(){return e.xor(t(u.Get(0),w.Get(0),q.Get(0)),l)}}}else this.Run=h}GetSID(){return this._sid}_GetFunc(){return this._func}GetObjectClass(){return this._objectClass}GetBehaviorType(){return this._behaviorType}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this.GetIndex()}IsTrigger(){return this._isTrigger}IsFastTrigger(){return this._isFastTrigger}IsInverted(){return this._isInverted}IsLooping(){return this._isLooping}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(c){this._debugData.isBreakpoint=
!!c;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}_RunSystem(){const c=this._results;b(this._parameters,c);return e.xor(this._func.apply(this._systemPlugin,c),
this._isInverted)}*_DebugRunSystem(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;b(this._parameters,c);c=this._func.apply(this._systemPlugin,c);e.IsIterator(c)&&(c=yield*c);return e.xor(c,this._isInverted)}return this.Run()}_RunSingleGlobal(){const c=this._results;b(this._parameters,c);const f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();return e.xor(this._func.apply(f,c),this._isInverted)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;b(this._parameters,c);const f=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();c=this._func.apply(f,c);e.IsIterator(c)&&(c=yield*c);return e.xor(c,this._isInverted)}return this.Run()}_RunFastTrigger(){return!0}*_DebugRunFastTrigger(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return!0}_RunStatic(){var c=this._results;b(this._parameters,c);c=this._func.apply(this._behaviorType||
this._objectClass,c);this._objectClass.ApplySolToContainer();return c}*_DebugRunStatic(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var c=this._results;b(this._parameters,c);c=this._func.apply(this._behaviorType||this._objectClass,c);e.IsIterator(c)&&(c=yield*c);this._objectClass.ApplySolToContainer();return c}return this.Run()}_RunObject(){const c=this._parameters,f=this._results,h=this._objectClass.GetCurrentSol();for(let g=0,l=c.length;g<
l;++g){const m=c[g];m.VariesPerInstance()||(f[g]=m.Get(0))}return h.IsSelectAll()?this._RunObject_FirstFilter(h):this._RunObject_NextFilter(h)}*_DebugRunObject(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this._RunObject()}_EvaluateVaryingParameters(c){const f=this._parameters,h=this._results;for(let g=0,l=f.length;g<l;++g){const m=f[g];m.VariesPerInstance()&&(h[g]=m.Get(c))}}_RunObject_FirstFilter(c){const f=this._objectClass,h=f.IsFamily(),g=f.GetFamilyIndex(),l=this._behaviorIndex,
m=0<=l,u=f.GetInstances(),w=this._anyParamVariesPerInstance,q=this._results,t=this._func,p=this._isInverted,r=this._isInOrBlock&&!this._isTrigger;c.ClearArrays();for(let y=0,D=u.length;y<D;++y){const G=u[y];w&&this._EvaluateVaryingParameters(y);var x=void 0;m?(x=h?G.GetObjectClass().GetFamilyBehaviorOffset(g):0,x=t.apply(G.GetBehaviorInstances()[l+x].GetSdkInstance(),q)):x=t.apply(G.GetSdkInstance(),q);e.xor(x,p)?c._PushInstance(G):r&&c._PushElseInstance(G)}f.FinishCondition(!0);c._SetSelectAll(!1);
f.ApplySolToContainer();return c.HasAnyInstances()}_RunObject_NextFilter(c){const f=this._objectClass;var h=f.IsFamily();const g=f.GetFamilyIndex(),l=f.IsInContainer(),m=this._behaviorIndex,u=0<=m,w=this._anyParamVariesPerInstance,q=this._results,t=this._func,p=this._isInverted,r=this._isInOrBlock&&!this._isTrigger,x=c._GetOwnInstances(),y=c._GetOwnElseInstances(),D=r&&!this._eventBlock.IsFirstConditionOfType(this),G=D?y:x;let A=0,F=!1;for(let B=0,I=G.length;B<I;++B){const L=G[B];w&&this._EvaluateVaryingParameters(B);
var J=void 0;u?(J=h?L.GetObjectClass().GetFamilyBehaviorOffset(g):0,J=t.apply(L.GetBehaviorInstances()[m+J].GetSdkInstance(),q)):J=t.apply(L.GetSdkInstance(),q);e.xor(J,p)?(F=!0,D?(x.push(L),l&&L._PushSiblingsToSolInstances()):(G[A]=L,l&&L._SetSiblingsToSolInstancesIndex(A),++A)):D?(G[A]=L,l&&L._SetSiblingsToSolElseInstancesIndex(A),++A):r&&(y.push(L),l&&L._PushSiblingsToSolElseInstances())}e.truncateArray(G,A);l&&f._TruncateContainerSols(D,A);h=F;D&&!F&&(F=this._OrBlockCheckInstances(x));f.FinishCondition(h||
r);return r?F:c.HasAnyInstances()}_OrBlockCheckInstances(c){var f=this._objectClass;const h=f.IsFamily();f=f.GetFamilyIndex();const g=this._anyParamVariesPerInstance,l=this._behaviorIndex,m=0<=l,u=this._results,w=this._func,q=this._isInverted;for(let p=0,r=c.length;p<r;++p){var t=c[p];g&&this._EvaluateVaryingParameters(p);if(m){const x=h?t.GetObjectClass().GetFamilyBehaviorOffset(f):0;t=w.apply(t.GetBehaviorInstances()[l+x].GetSdkInstance(),u)}else t=w.apply(t.GetSdkInstance(),u);if(e.xor(t,q))return!0}return!1}ReevaluateParameter(c,
f){return this._parameters[c].Get(f)}GetFastTriggerValue(){const c=this._parameters;if(!c.length)throw Error("no parameters");return c[0]._GetFastTriggerValue()}_SaveToJson(){if(!this._savedData||!this._savedData.size)return null;const c={};for(const [f,h]of this._savedData.entries()){let g=h;"collmemory"===f&&(g=[...h.entries()].map(l=>[l[0].GetUID(),l[1].GetUID(),l[2]]));c[f]=g}return{ex:c}}_LoadFromJson(c){this._savedData&&(this._savedData.clear(),this._savedData=null);if(c){var f=this._runtime,
h=c.ex;if(h){c=this.GetSavedDataMap();c.clear();for(const [g,l]of Object.entries(h))h=l,"collmemory"===g&&(h=e.New(e.PairMap,l.map(m=>[f.GetInstanceByUID(m[0]),f.GetInstanceByUID(m[1]),m[2]]).filter(m=>m[0]&&m[1]))),c.set(g,h)}}}}}
{"use strict";const e=self.C3;function b(f,h){for(let g=0,l=f.length;g<l;++g)h[g]=f[g].Get(0)}const a=[],d=function(){},c=function*(){};e.Action=class extends e.DefendedBase{constructor(f,h,g){super();this._eventBlock=f;this._runtime=f=f.GetRuntime();this._index=g;this._sid=4<=h.length?h[3]:-1;this._actionReturnType=5<=h.length?h[4]:0;this._behaviorType=this._objectClass=this._func=null;this._behaviorIndex=-1;this._systemPlugin=null;this._callFunctionName="";this._combinedSolModifiers=this._callEventBlock=
null;this.DebugRun=this.Run=d;this._parameters=[];this._results=[];this._anyParamVariesPerInstance=!1;this._unsavedData=this._savedData=null;const l=(g=-3===h[0])?h[2]:h[5];this._debugData=f.IsDebug()||g?{isBreakpoint:l[0],canDebug:l[1],index:l[2]}:null;-1===h[0]?(this._systemPlugin=f.GetSystemPlugin(),this._func=f.GetObjectReference(h[1])):-2===h[0]?this._callFunctionName=h[1]:g?(this._func=f.GetObjectReference(h[1]),this.Run=this.RunUserScript,this.DebugRun=this.DebugRunUserScript,this._actionReturnType=
1):(this._func=f.GetObjectReference(h[1]),this._objectClass=f.GetObjectClassByIndex(h[0]),h[2]&&(this._behaviorType=this._objectClass.GetBehaviorTypeByName(h[2]),this._behaviorIndex=this._objectClass.GetBehaviorIndexByName(h[2])));if(7===h.length){h=h[6];for(const m of h)this._parameters.push(e.Parameter.Create(this,m,this._parameters.length)),this._results.push(0)}0===this._parameters.length&&(this._results=this._parameters=a);this._eventBlock.GetEventSheetManager()._RegisterAction(this)}static Create(f,
h,g){return e.New(e.Action,f,h,g)}_PostInit(){for(var f of this._parameters)f._PostInit(),f.VariesPerInstance()&&(this._anyParamVariesPerInstance=!0);if(this._systemPlugin)this._SetSystemRunMethod(),this.DebugRun=this._DebugRunSystem;else if(this._callFunctionName)this._SetCallFunctionRunMethod(),this._callFunctionName="";else if(this.Run===this.RunUserScript){f=this._func;const h=this._runtime.GetEventSheetManager()._GetLocalVariablesScriptInterface(this._eventBlock);this._func=f.bind(null,this._runtime.GetIRuntime(),
h)}else this._behaviorType?this.IsAsync()?(this.Run=this._RunBehavior_Async,this.DebugRun=this._DebugRunBehavior_Async):(this.Run=this._RunBehavior,this.DebugRun=this._DebugRunBehavior):this._objectClass.GetPlugin().IsSingleGlobal()?(this._SetSingleGlobalRunMethod(),this.DebugRun=this._DebugRunSingleGlobal):this.IsAsync()?(this.Run=this._RunObject_Async,this.DebugRun=this._DebugRunObject_Async):this._parameters.length?this._parameters.every(h=>h.VariesPerInstance())?(this.Run=this._RunObject_AllParamsVary,
this.DebugRun=this._DebugRunObject_AllParamsVary):this._anyParamVariesPerInstance?(this.Run=this._RunObject_SomeParamsVary,this.DebugRun=this._DebugRunObject_SomeParamsVary):this._parameters.every(h=>h.IsConstant())?(b(this._parameters,this._results),this.Run=this._RunObject_ParamsConst,this.DebugRun=this._DebugRunObject_ParamsConst):(this.Run=this._RunObject_ParamsDontVary,this.DebugRun=this._DebugRunObject_ParamsDontVary):(this.Run=this._RunObject_ParamsConst,this.DebugRun=this._DebugRunObject_ParamsConst)}_SetSystemRunMethod(){this._SetRunMethodForBoundFunc(this._systemPlugin,
this._systemPlugin,this._RunSystem)}_SetSingleGlobalRunMethod(){const f=this._objectClass.GetPlugin(),h=this._objectClass.GetSingleGlobalInstance().GetSdkInstance();this._SetRunMethodForBoundFunc(f,h,this._RunSingleGlobal)}_SetCallFunctionRunMethod(){const f=this._eventBlock.GetEventSheetManager(),h=f.GetFunctionBlockByName(this._callFunctionName);h.IsEnabled()?(this._callEventBlock=h.GetEventBlock(),this._combinedSolModifiers=[...new Set([...this._eventBlock.GetSolModifiersIncludingParents(),...this._callEventBlock.GetSolModifiersIncludingParents()])],
this._combinedSolModifiers=f._DeduplicateSolModifierList(this._combinedSolModifiers),this.Run=e.EventBlock.prototype.RunAsFunctionCall.bind(this._callEventBlock,this._combinedSolModifiers,this._parameters),this.DebugRun=this._DebugRunCallFunction):(this.Run=d,this.DebugRun=c)}_SetRunMethodForBoundFunc(f,h,g){const l=this._func,m=this._parameters;if(0===m.length)this.Run=f._GetBoundACEMethod(l,h);else if(1===m.length){const u=m[0];if(u.IsConstant())this.Run=f._GetBoundACEMethod_1param(l,h,u.Get(0));
else{const w=f._GetBoundACEMethod(l,h);this.Run=function(){return w(u.Get(0))}}}else if(2===m.length){const u=m[0],w=m[1];if(u.IsConstant()&&w.IsConstant())this.Run=f._GetBoundACEMethod_2params(l,h,u.Get(0),w.Get(0));else{const q=f._GetBoundACEMethod(l,h);this.Run=function(){return q(u.Get(0),w.Get(0))}}}else if(3===m.length){const u=m[0],w=m[1],q=m[2];if(u.IsConstant()&&w.IsConstant()&&q.IsConstant())this.Run=f._GetBoundACEMethod_3params(l,h,u.Get(0),w.Get(0),q.Get(0));else{const t=f._GetBoundACEMethod(l,
h);this.Run=function(){return t(u.Get(0),w.Get(0),q.Get(0))}}}else this.Run=g}GetSID(){return this._sid}IsAsync(){return 1===this._actionReturnType}CanBailOut(){return 2===this._actionReturnType}HasReturnType(){return 0!==this._actionReturnType}GetObjectClass(){return this._objectClass}GetEventBlock(){return this._eventBlock}GetRuntime(){return this._runtime}GetIndex(){return this._index}GetDebugIndex(){return this._debugData.index}GetCombinedSolModifiers(){return this._combinedSolModifiers}IsBreakpoint(){return this._debugData.isBreakpoint}_SetBreakpoint(f){this._debugData.isBreakpoint=
!!f;this._eventBlock._UpdateCanRunFastRecursive()}_DebugReturnsGenerator(){return this._debugData.canDebug}DebugCanRunFast(){return!this.IsBreakpoint()&&!this._runtime.DebugBreakNext()&&!this._DebugReturnsGenerator()}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}_RunSystem(){const f=this._results;b(this._parameters,f);return this._func.apply(this._systemPlugin,f)}*_DebugRunSystem(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;b(this._parameters,f);return yield*this._func.apply(this._systemPlugin,f)}return this.Run()}*_DebugRunCallFunction(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return yield*this._callEventBlock.DebugRunAsFunctionCall(this._combinedSolModifiers,this._parameters)}_RunSingleGlobal(){const f=this._results;b(this._parameters,f);return this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),
f)}*_DebugRunSingleGlobal(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;b(this._parameters,f);return yield*this._func.apply(this._objectClass.GetSingleGlobalInstance().GetSdkInstance(),f)}return this.Run()}_RunObject_ParamsConst(){const f=this._results,h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)this._func.apply(h[g].GetSdkInstance(),f)}*_DebugRunObject_ParamsConst(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results,h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)yield*this._func.apply(h[g].GetSdkInstance(),f)}else this._RunObject_ParamsConst()}_RunObject_ParamsDontVary(){const f=this._results;b(this._parameters,f);const h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)this._func.apply(h[g].GetSdkInstance(),f)}*_DebugRunObject_ParamsDontVary(){if(this.IsBreakpoint()||
this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._results;b(this._parameters,f);const h=this._objectClass.GetCurrentSol().GetInstances();for(let g=0,l=h.length;g<l;++g)yield*this._func.apply(h[g].GetSdkInstance(),f)}else this._RunObject_ParamsDontVary()}_RunObject_AllParamsVary(){const f=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let m=0,u=l.length;m<u;++m){const w=l[m];for(let q=0,t=f.length;q<t;++q)h[q]=
f[q].Get(m);g.apply(w.GetSdkInstance(),h)}}*_DebugRunObject_AllParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let m=0,u=l.length;m<u;++m){const w=l[m];for(let q=0,t=f.length;q<t;++q)h[q]=f[q].Get(m);yield*g.apply(w.GetSdkInstance(),h)}}else this._RunObject_AllParamsVary()}_RunObject_SomeParamsVary(){const f=this._parameters,
h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances();for(let u=0,w=f.length;u<w;++u){var m=f[u];m.VariesPerInstance()||(h[u]=m.Get(0))}for(let u=0,w=l.length;u<w;++u){m=l[u];for(let q=0,t=f.length;q<t;++q){const p=f[q];p.VariesPerInstance()&&(h[q]=p.Get(u))}g.apply(m.GetSdkInstance(),h)}}*_DebugRunObject_SomeParamsVary(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const h=this._parameters,g=this._results,l=this._func,
m=this._objectClass.GetCurrentSol().GetInstances();for(let u=0,w=h.length;u<w;++u){var f=h[u];f.VariesPerInstance()||(g[u]=f.Get(0))}for(let u=0,w=m.length;u<w;++u){f=m[u];for(let q=0,t=h.length;q<t;++q){const p=h[q];p.VariesPerInstance()&&(g[q]=p.Get(u))}yield*l.apply(f.GetSdkInstance(),g)}}else this._RunObject_SomeParamsVary()}_RunBehavior(){var f=this._objectClass;const h=f.IsFamily(),g=f.GetFamilyIndex(),l=this._parameters,m=this._anyParamVariesPerInstance,u=this._results,w=this._func,q=this._behaviorIndex;
f=f.GetCurrentSol().GetInstances();for(let r=0,x=l.length;r<x;++r){var t=l[r];t.VariesPerInstance()||(u[r]=t.Get(0))}for(let r=0,x=f.length;r<x;++r){t=f[r];if(m)for(let y=0,D=l.length;y<D;++y){var p=l[y];p.VariesPerInstance()&&(u[y]=p.Get(r))}p=h?t.GetObjectClass().GetFamilyBehaviorOffset(g):0;w.apply(t.GetBehaviorInstances()[q+p].GetSdkInstance(),u)}}*_DebugRunBehavior(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var f=this._objectClass;const l=
f.IsFamily(),m=f.GetFamilyIndex(),u=this._parameters,w=this._anyParamVariesPerInstance,q=this._results,t=this._func,p=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();for(let r=0,x=u.length;r<x;++r){var h=u[r];h.VariesPerInstance()||(q[r]=h.Get(0))}for(let r=0,x=f.length;r<x;++r){h=f[r];if(w)for(let y=0,D=u.length;y<D;++y){var g=u[y];g.VariesPerInstance()&&(q[y]=g.Get(r))}g=l?h.GetObjectClass().GetFamilyBehaviorOffset(m):0;yield*t.apply(h.GetBehaviorInstances()[p+g].GetSdkInstance(),q)}}else this._RunBehavior()}_RunObject_Async(){const f=
this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances(),m=[];for(let u=0,w=l.length;u<w;++u){const q=l[u];for(let t=0,p=f.length;t<p;++t)h[t]=f[t].Get(u);m.push(g.apply(q.GetSdkInstance(),h))}return Promise.all(m)}*_DebugRunObject_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){const f=this._parameters,h=this._results,g=this._func,l=this._objectClass.GetCurrentSol().GetInstances(),m=[];for(let u=0,
w=l.length;u<w;++u){const q=l[u];for(let t=0,p=f.length;t<p;++t)h[t]=f[t].Get(u);m.push(yield*g.apply(q.GetSdkInstance(),h))}return Promise.all(m)}return this._RunObject_Async()}_RunBehavior_Async(){var f=this._objectClass;const h=f.IsFamily(),g=f.GetFamilyIndex(),l=this._parameters,m=this._results,u=this._func,w=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();const q=[];for(let t=0,p=f.length;t<p;++t){const r=f[t];for(let y=0,D=l.length;y<D;++y)m[y]=l[y].Get(t);const x=h?r.GetObjectClass().GetFamilyBehaviorOffset(g):
0;q.push(u.apply(r.GetBehaviorInstances()[w+x].GetSdkInstance(),m))}return Promise.all(q)}*_DebugRunBehavior_Async(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;if(this._DebugReturnsGenerator()){var f=this._objectClass;const h=f.IsFamily(),g=f.GetFamilyIndex(),l=this._parameters,m=this._results,u=this._func,w=this._behaviorIndex;f=f.GetCurrentSol().GetInstances();const q=[];for(let t=0,p=f.length;t<p;++t){const r=f[t];for(let y=0,D=l.length;y<D;++y)m[y]=l[y].Get(t);const x=h?
r.GetObjectClass().GetFamilyBehaviorOffset(g):0;q.push(yield*u.apply(r.GetBehaviorInstances()[w+x].GetSdkInstance(),m))}return Promise.all(q)}return this._RunBehavior_Async()}async RunUserScript(){try{await this._func()}catch(f){console.error(`Unhandled exception running script %c${this._eventBlock.GetEventSheet().GetName()}, event ${this._eventBlock.GetDisplayNumber()}, action ${this.GetDebugIndex()+1}:`,"font-size: 1.2em; font-weight: bold;",f),self.C3Debugger&&self.C3Debugger._SetLastErrorScript(this),
e.EventScript.HadUserScriptException()||(console.info("%cTip:%c run this to highlight in Construct the last script that had an error: %cgoToLastErrorScript()","font-weight: bold; text-decoration: underline","","font-weight: bold"),e.EventScript.SetHadUserScriptException())}}*DebugRunUserScript(){if(this.IsBreakpoint()||this._runtime.DebugBreakNext())yield this;return this.RunUserScript()}_SaveToJson(){return this._savedData&&this._savedData.size?{ex:e.ToSuperJSON(this._savedData)}:null}_LoadFromJson(f){this._savedData&&
(this._savedData.clear(),this._savedData=null);f&&(f=f.ex)&&(this._savedData=e.FromSuperJSON(f))}}}
{"use strict";const e=self.C3,b=new e.Color;function a(N,P){return e.compare(this.GetWorldInfo().GetX(),N,P)}function d(N,P){return e.compare(this.GetWorldInfo().GetY(),N,P)}function c(){const N=this.GetWorldInfo(),P=N.GetLayer();return P.Has3DCamera()?N.IsInViewport3D(P._GetViewFrustum()):N.IsInViewport(P.GetViewport(),N.GetLayout().HasVanishingPointOutsideViewport(),N.GetLayout().IsOrthographicProjection())}function f(){var N=this.GetWorldInfo();const P=N.GetLayout();N=N.GetBoundingBox();return 0>
N.getRight()||0>N.getBottom()||N.getLeft()>P.GetWidth()||N.getTop()>P.GetHeight()}function h(N,P,W){const aa=this.GetCurrentSol(),ea=aa.GetInstances();if(!ea.length)return!1;let ca=ea[0];var ia=ca.GetWorldInfo();let oa=ca,ja=e.distanceSquared(ia.GetX(),ia.GetY(),P,W);for(let wa=1,Ka=ea.length;wa<Ka;++wa)if(ca=ea[wa],ia=ca.GetWorldInfo(),ia=e.distanceSquared(ia.GetX(),ia.GetY(),P,W),0===N&&ia<ja||1===N&&ia>ja)ja=ia,oa=ca;aa.PickOne(oa);return!0}function g(N){const P=this.GetWorldInfo();P.GetX()!==
N&&(P.SetX(N),P.SetBboxChanged())}function l(N){const P=this.GetWorldInfo();P.GetY()!==N&&(P.SetY(N),P.SetBboxChanged())}function m(N,P){const W=this.GetWorldInfo();W.EqualsXY(N,P)||(W.SetXY(N,P),W.SetBboxChanged())}function u(N,P){if(N&&(N=N.GetPairedInstance(this._inst))){var [W,aa]=N.GetImagePoint(P);P=this.GetWorldInfo();if(P.GetX()!==W||P.GetY()!==aa)P.SetXY(W,aa),P.SetBboxChanged()}}function w(N){if(0!==N){var P=this.GetWorldInfo();P.OffsetXY(P.GetCosAngle()*N,P.GetSinAngle()*N);P.SetBboxChanged()}}
function q(N,P){if(0!==P){var W=this.GetWorldInfo();N=e.toRadians(N);W.OffsetXY(Math.cos(N)*P,Math.sin(N)*P);W.SetBboxChanged()}}function t(){return this.GetWorldInfo().GetX()}function p(){return this.GetWorldInfo().GetY()}function r(){return this._runtime.GetDt(this._inst)}function x(N,P){return e.compare(this.GetWorldInfo().GetWidth(),N,P)}function y(N,P){return e.compare(this.GetWorldInfo().GetHeight(),N,P)}function D(N){const P=this.GetWorldInfo();P.GetWidth()!==N&&(P.SetWidth(N),P.SetBboxChanged())}
function G(N){const P=this.GetWorldInfo();P.GetHeight()!==N&&(P.SetHeight(N),P.SetBboxChanged())}function A(N,P){const W=this.GetWorldInfo();if(W.GetWidth()!==N||W.GetHeight()!==P)W.SetSize(N,P),W.SetBboxChanged()}function F(){return this.GetWorldInfo().GetWidth()}function J(){return this.GetWorldInfo().GetHeight()}function B(){return this.GetWorldInfo().GetBoundingBox().getLeft()}function I(){return this.GetWorldInfo().GetBoundingBox().getTop()}function L(){return this.GetWorldInfo().GetBoundingBox().getRight()}
function Q(){return this.GetWorldInfo().GetBoundingBox().getBottom()}function S(N,P){return e.angleDiff(this.GetWorldInfo().GetAngle(),e.toRadians(P))<=e.toRadians(N)}function U(N){return e.angleClockwise(this.GetWorldInfo().GetAngle(),e.toRadians(N))}function V(N,P){N=e.toRadians(N);P=e.toRadians(P);const W=this.GetWorldInfo().GetAngle();return e.angleClockwise(P,N)?e.angleClockwise(W,N)&&!e.angleClockwise(W,P):!(!e.angleClockwise(W,N)&&e.angleClockwise(W,P))}function Z(N){const P=this.GetWorldInfo();
N=e.clampAngle(e.toRadians(N));isNaN(N)||P.GetAngle()===N||(P.SetAngle(N),P.SetBboxChanged())}function ma(N){if(!isNaN(N)&&0!==N){var P=this.GetWorldInfo();P.SetAngle(P.GetAngle()+e.toRadians(N));P.SetBboxChanged()}}function va(N){if(!isNaN(N)&&0!==N){var P=this.GetWorldInfo();P.SetAngle(P.GetAngle()-e.toRadians(N));P.SetBboxChanged()}}function Na(N,P){const W=this.GetWorldInfo(),aa=W.GetAngle();N=e.angleRotate(aa,e.toRadians(P),e.toRadians(N));isNaN(N)||aa===N||(W.SetAngle(N),W.SetBboxChanged())}
function Ea(N,P,W){const aa=this.GetWorldInfo(),ea=aa.GetAngle();P-=aa.GetX();W-=aa.GetY();N=e.angleRotate(ea,Math.atan2(W,P),e.toRadians(N));isNaN(N)||ea===N||(aa.SetAngle(N),aa.SetBboxChanged())}function Ia(N,P){const W=this.GetWorldInfo(),aa=W.GetAngle();N-=W.GetX();P-=W.GetY();P=Math.atan2(P,N);isNaN(P)||aa===P||(W.SetAngle(P),W.SetBboxChanged())}function Ma(){return e.toDegrees(this.GetWorldInfo().GetAngle())}function Fa(N,P){return e.compare(e.round6dp(100*this.GetWorldInfo().GetOpacity()),
N,P)}function ya(){return this.GetWorldInfo().IsVisible()}function na(N){const P=this.GetWorldInfo();N=2===N?!P.IsVisible():0!==N;P.IsVisible()!==N&&(P.SetVisible(N),this._runtime.UpdateRender())}function Va(N){N=e.clamp(N/100,0,1);const P=this.GetWorldInfo();P.GetOpacity()!==N&&(P.SetOpacity(N),this._runtime.UpdateRender())}function xa(N){b.setFromRgbValue(N);N=this.GetWorldInfo();N.GetUnpremultipliedColor().equalsIgnoringAlpha(b)||(N.SetUnpremultipliedColor(b),this._runtime.UpdateRender())}function Ga(){const N=
this.GetWorldInfo().GetUnpremultipliedColor();return e.PackRGBAEx(N.getR(),N.getG(),N.getB(),N.getA())}function bb(){return e.round6dp(100*this.GetWorldInfo().GetOpacity())}function Xa(N){return N?this.GetWorldInfo().GetLayer()===N:!1}function ob(N){const P=this.GetCurrentSol(),W=P.GetInstances();if(!W.length)return!1;let aa=W[0];for(let ea=1,ca=W.length;ea<ca;++ea){const ia=W[ea],oa=ia.GetWorldInfo(),ja=aa.GetWorldInfo(),wa=oa.GetLayer().GetIndex(),Ka=ja.GetLayer().GetIndex();if(0===N){if(wa>Ka||
wa===Ka&&oa.GetZIndex()>ja.GetZIndex())aa=ia}else if(wa<Ka||wa===Ka&&oa.GetZIndex()<ja.GetZIndex())aa=ia}P.PickOne(aa);return!0}function pb(N,P,W){const aa=this.GetWorldInfo();N=0===N?aa.GetZElevation():aa.GetTotalZElevation();return e.compare(N,P,W)}function cb(){this.GetWorldInfo().ZOrderMoveToTop()}function qb(){this.GetWorldInfo().ZOrderMoveToBottom()}function rb(N){N&&this.GetWorldInfo().ZOrderMoveToLayer(N)}function sb(N,P){N=0===N;P&&(P=P.GetFirstPicked(this.GetInstance()))&&this.GetWorldInfo().ZOrderMoveAdjacentToInstance(P,
N)}function tb(N){const P=this.GetWorldInfo();P.GetZElevation()!==N&&(P.SetZElevation(N),this._runtime.UpdateRender())}function ub(){return this.GetWorldInfo().GetLayer().GetIndex()}function vb(){return this.GetWorldInfo().GetLayer().GetName()}function wb(){return this.GetWorldInfo().GetZIndex()}function db(){return this.GetWorldInfo().GetZElevation()}function xb(){return this.GetWorldInfo().GetTotalZElevation()}function yb(N,P){if(P=this.GetObjectClass().GetEffectList().GetEffectTypeByName(P)){P=
P.GetIndex();N=1===N;var W=this.GetWorldInfo().GetInstanceEffectList();W.IsEffectIndexActive(P)!==N&&(W.SetEffectIndexActive(P,N),W.UpdateActiveEffects(),this._runtime.UpdateRender())}}function zb(N,P,W){var aa=this.GetObjectClass().GetEffectList().GetEffectTypeByName(N);if(aa){N=aa.GetIndex();var ea=this.GetWorldInfo().GetInstanceEffectList(),ca=ea.GetEffectParametersForIndex(N);P=Math.floor(P);if(!(0>P||P>=ca.length)){aa=aa.GetShaderProgram().GetParameterType(P);if("color"===aa){b.setFromRgbValue(W);
P=ca[P];if(b.equalsIgnoringAlpha(P))return;P.copyRgb(b)}else{"percent"===aa&&(W/=100);if(ca[P]===W)return;ca[P]=W}ea.IsEffectIndexActive(N)&&this._runtime.UpdateRender()}}}const eb=e.New(e.Rect),Wa=[],fb=[];let gb=!1,Ya=null,hb=!1;const Ta=new Set;function ib(N,P,W,aa){const ea=P.GetUID(),ca=W.GetUID();ea<ca?N.Set(P,W,aa):N.Set(W,P,aa)}function jb(N,P,W){const aa=P.GetUID(),ea=W.GetUID();aa<ea?N.Delete(P,W):N.Delete(W,P)}function sa(N,P){N.DeleteEither(P)}function Sa(N,P,W){const aa=P.GetUID(),ea=
W.GetUID();return aa<ea?N.Get(P,W):N.Get(W,P)}function Ab(N,P,W,aa){if(!P)return!1;N=N.GetInstance();const ea=0!==W||0!==aa,ca=N.GetWorldInfo(),ia=N.GetRuntime(),oa=ia.GetCollisionEngine();var ja=ia.GetCurrentCondition();const wa=ja.GetEventBlock().IsOrBlock();var Ka=ja.GetObjectClass();ja=ja.IsInverted();const Oa=P.GetCurrentSol();Ka=Ka!==P;Ya=P;gb=Ka&&!ja;hb=!1;let Za=0,La=0,la=!1;Oa.IsSelectAll()?(eb.copy(ca.GetBoundingBox()),eb.offset(W,aa),oa.GetCollisionCandidates(ca.GetLayer(),P,eb,fb),P=fb):
wa?ia.IsCurrentConditionFirst()&&!Oa._GetOwnElseInstances().length&&Oa._GetOwnInstances().length?P=Oa._GetOwnInstances():(P=Oa._GetOwnElseInstances(),hb=!0):P=Oa._GetOwnInstances();ea&&(Za=ca.GetX(),La=ca.GetY(),ca.OffsetXY(W,aa),ca.SetBboxChanged());for(const da of P)if(oa.TestOverlap(N,da)){la=!0;if(ja)break;Ka&&Ta.add(da)}ea&&(ca.SetXY(Za,La),ca.SetBboxChanged());e.clearArray(fb);return la}function Db(N){N=N.GetRuntime().GetCurrentEvent().IsOrBlock();const P=Ya.GetCurrentSol(),W=P._GetOwnInstances(),
aa=P._GetOwnElseInstances();P.IsSelectAll()?(P.SetSetPicked(Ta),N&&(e.clearArray(aa),P.AddElseInstances(Ta,Ya.GetInstances()))):N?hb?P.TransferElseInstancesToOwn(Ta):(P.AddElseInstances(Ta,W),P.SetSetPicked(Ta)):P.SetSetPicked(Ta);Ya.ApplySolToContainer()}function Eb(N,P){gb&&(P&&Db(N),Ta.clear(),Ya=null,gb=!1)}function Fb(N){if(this._runtime.IsDebugging())return Gb.call(this,N);if(!N)return!1;var P=this._runtime;const W=P.GetCollisionEngine(),aa=P.GetEventSheetManager(),ea=aa.GetEventStack();var ca=
aa.GetCurrentCondition();const ia=ca.GetObjectClass();var oa=ca.GetSavedDataMap(),ja=ca.GetUnsavedDataMap();ca=ea.GetCurrentStackFrame();const wa=P.GetTickCount(),Ka=wa-1,Oa=ca.GetCurrentEvent(),Za=ea.Push(Oa);let La=oa.get("collmemory");La||(La=e.New(e.PairMap),oa.set("collmemory",La));ja.get("collisionCreatedDestroyCallback")||(ja.set("collisionCreatedDestroyCallback",!0),P.Dispatcher().addEventListener("instancedestroy",Ua=>sa(La,Ua.instance)));oa=ia.GetCurrentSol();P=N.GetCurrentSol();oa=oa.GetInstances();
ja=null;for(let Ua=0;Ua<oa.length;++Ua){const Ha=oa[Ua];P.IsSelectAll()?(W.GetCollisionCandidates(Ha.GetWorldInfo().GetLayer(),N,Ha.GetWorldInfo().GetBoundingBox(),Wa),ja=Wa,W.AddRegisteredCollisionCandidates(Ha,N,ja)):ja=P.GetInstances();for(let ab=0;ab<ja.length;++ab){const Ra=ja[ab];if(W.TestOverlap(Ha,Ra)||W.CheckRegisteredCollision(Ha,Ra)){var la=Sa(La,Ha,Ra),da=!1,pa=-2;"number"===typeof la&&(da=!0,pa=la);la=!da||pa<Ka;ib(La,Ha,Ra,wa);la&&(la=Oa.GetSolModifiers(),aa.PushCopySol(la),pa=ia.GetCurrentSol(),
da=N.GetCurrentSol(),pa._SetSelectAll(!1),da._SetSelectAll(!1),ia===N?(da=pa._GetOwnInstances(),e.clearArray(da),da.push(Ha),da.push(Ra),ia.ApplySolToContainer()):(pa=pa._GetOwnInstances(),da=da._GetOwnInstances(),e.clearArray(pa),e.clearArray(da),pa.push(Ha),da.push(Ra),ia.ApplySolToContainer(),N.ApplySolToContainer()),Oa.Retrigger(ca,Za),aa.PopSol(la))}else jb(La,Ha,Ra)}e.clearArray(Wa)}ea.Pop();return!1}function*Gb(N){if(!N)return!1;var P=this._runtime;const W=P.GetCollisionEngine(),aa=P.GetEventSheetManager(),
ea=aa.GetEventStack();var ca=aa.GetCurrentCondition();const ia=ca.GetObjectClass();var oa=ca.GetSavedDataMap(),ja=ca.GetUnsavedDataMap();ca=ea.GetCurrentStackFrame();const wa=P.GetTickCount(),Ka=wa-1,Oa=ca.GetCurrentEvent(),Za=ea.Push(Oa);let La=oa.get("collmemory");La||(La=e.New(e.PairMap),oa.set("collmemory",La));ja.get("collisionCreatedDestroyCallback")||(ja.set("collisionCreatedDestroyCallback",!0),P.Dispatcher().addEventListener("instancedestroy",Ua=>sa(La,Ua.instance)));oa=ia.GetCurrentSol();
P=N.GetCurrentSol();oa=oa.GetInstances();ja=null;for(let Ua=0;Ua<oa.length;++Ua){const Ha=oa[Ua];P.IsSelectAll()?(W.GetCollisionCandidates(Ha.GetWorldInfo().GetLayer(),N,Ha.GetWorldInfo().GetBoundingBox(),Wa),ja=Wa,W.AddRegisteredCollisionCandidates(Ha,N,ja)):ja=P.GetInstances();for(let ab=0;ab<ja.length;++ab){const Ra=ja[ab];if(W.TestOverlap(Ha,Ra)||W.CheckRegisteredCollision(Ha,Ra)){var la=Sa(La,Ha,Ra),da=!1,pa=-2;"number"===typeof la&&(da=!0,pa=la);la=!da||pa<Ka;ib(La,Ha,Ra,wa);la&&(la=Oa.GetSolModifiers(),
aa.PushCopySol(la),pa=ia.GetCurrentSol(),da=N.GetCurrentSol(),pa._SetSelectAll(!1),da._SetSelectAll(!1),ia===N?(da=pa._GetOwnInstances(),e.clearArray(da),da.push(Ha),da.push(Ra),ia.ApplySolToContainer()):(pa=pa._GetOwnInstances(),da=da._GetOwnInstances(),e.clearArray(pa),e.clearArray(da),pa.push(Ha),da.push(Ra),ia.ApplySolToContainer(),N.ApplySolToContainer()),yield*Oa.DebugRetrigger(ca,Za),aa.PopSol(la))}else jb(La,Ha,Ra)}e.clearArray(Wa)}ea.Pop();return!1}function Hb(N){return Ab(this,N,0,0)}function kb(N,
P,W){return Ab(this,N,P,W)}function lb(){return this.GetWorldInfo().HasParent()}function mb(){return this.GetWorldInfo().HasChildren()}function nb(N,P){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const aa=N.GetCurrentSol();var ea=aa.GetInstances();if(0===ea.length)return!1;ea=new Set(ea);const ca=new Set;for(let oa=0,ja=W.length;oa<ja;++oa){var ia=W[oa];if(1===P)for(const wa of ia.parents())wa.BelongsToObjectClass(N)&&ea.has(wa)&&ca.add(wa);else{if(0===P){if(ia=ia.GetParent(),
null===ia)continue}else ia=ia.GetTopParent();ia.BelongsToObjectClass(N)&&ea.has(ia)&&ca.add(ia)}}if(0===ca.size)return!1;aa.SetSetPicked(ca);N.ApplySolToContainer();return!0}function $a(N,P){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const aa=N.GetCurrentSol();var ea=aa.GetInstances();if(aa.IsSelectAll()){var ca=[...this._runtime.instancesPendingCreateForObjectClass(N)];0<ca.length&&(ea=ea.concat(ca))}if(0===ea.length)return!1;ea=new Set(ea);ca=new Set;for(let ia=0,oa=W.length;ia<
oa;++ia){const ja=W[ia];2===P&&!ja.HasChildren()&&ja.BelongsToObjectClass(N)&&ea.has(ja)&&ca.add(ja);for(const wa of 0===P?ja.children():ja.allChildren())2===P&&wa.HasChildren()||wa.BelongsToObjectClass(N)&&ea.has(wa)&&ca.add(wa)}if(0===ca.size)return!1;aa.SetSetPicked(ca);N.ApplySolToContainer();return!0}function k(N,P){const W=this.GetCurrentSol().GetInstances();if(0===W.length)return!1;const aa=N.GetCurrentSol();var ea=aa.GetInstances();if(aa.IsSelectAll()){var ca=[...this._runtime.instancesPendingCreateForObjectClass(N)];
0<ca.length&&(ea=ea.concat(ca))}if(0===ea.length)return!1;ea=new Set(ea);ca=[];for(let ia=0,oa=W.length;ia<oa;++ia){const ja=W[ia].GetChildAt(P);null!==ja&&ja.BelongsToObjectClass(N)&&ea.has(ja)&&ca.push(ja)}if(0===ca.length)return!1;aa.SetArrayPicked(ca);N.ApplySolToContainer();return!0}function n(N,P){return e.compare(this._inst.GetChildCount(),N,P)}function v(N,P,W,aa,ea,ca,ia,oa){const ja=this._inst,wa=this._runtime.GetCurrentAction().GetObjectClass();for(const Ka of N.allCorrespondingInstances(ja,
wa)){if(!Ka.GetPlugin().SupportsSceneGraph())break;ja.AddChild(Ka,{transformX:P,transformY:W,transformWidth:aa,transformHeight:ea,transformAngle:ca,transformZElevation:ia,destroyWithParent:oa})}}function z(N){const P=this._inst,W=this._runtime.GetCurrentAction().GetObjectClass();for(const aa of N.allCorrespondingInstances(P,W))P.RemoveChild(aa)}function C(){this._inst.HasParent()&&this._inst.GetParent().RemoveChild(this._inst)}function E(){return this._inst.GetChildCount()}function H(N,P){N=Math.floor(N);
P=Math.floor(P);const W=this.GetWorldInfo();2>N||2>P||!isFinite(N)||!isFinite(P)?(W.ReleaseMesh(),W.SetBboxChanged()):W.CreateMesh(N,P)}function K(N,P,W,aa,ea,ca,ia,oa){const ja=this.GetWorldInfo();ja.SetMeshPoint(N,P,{mode:0===W?"absolute":"relative",x:aa,y:ea,zElevation:ca,u:ia,v:oa})&&ja.SetBboxChanged()}function M(){const N=this.GetWorldInfo();return N.HasMesh()?N.GetSourceMesh().GetHSize():0}function O(){const N=this.GetWorldInfo();return N.HasMesh()?N.GetSourceMesh().GetVSize():0}function R(N){const P=
this.GetWorldInfo();N=2===N?!P.IsVisible():0!==N;P.IsVisible()!==N&&P.SetVisible(N)}function T(N,P){this.SetElementCSSStyle(N,P)}function Y(N,P){this.SetElementAttribute(N,""+P)}function X(N){this.RemoveElementAttribute(N)}function fa(){this.FocusElement()}function ha(){this.BlurElement()}function ba(){return this.IsElementFocused()}function qa(N){this._SetEnabled(0!==N)}function ka(){return this._IsEnabled()}function ta(N,P,W){return e.compare(this.GetInstance().GetInstanceVariableValue(N),P,W)}
function ua(N){return!!this.GetInstance().GetInstanceVariableValue(N)}function ra(N,P){const W=this.GetCurrentSol(),aa=W.GetInstances();if(!aa.length)return!1;let ea=aa[0],ca=ea,ia=ea.GetInstanceVariableValue(P);for(let oa=1,ja=aa.length;oa<ja;++oa){ea=aa[oa];const wa=ea.GetInstanceVariableValue(P);if(0===N&&wa<ia||1===N&&wa>ia)ia=wa,ca=ea}W.PickOne(ca);return!0}function za(N){return this._runtime.GetCurrentCondition().IsInverted()?Ba(this,N):Aa(this,N)}function Aa(N,P){P=N.GetRuntime().GetInstanceByUID(P);
if(!P)return!1;const W=N.GetCurrentSol();if(!W.IsSelectAll()&&!W._GetOwnInstances().includes(P))return!1;if(N.IsFamily()){if(P.GetObjectClass().BelongsToFamily(N))return W.PickOne(P),N.ApplySolToContainer(),!0}else if(P.GetObjectClass()===N)return W.PickOne(P),N.ApplySolToContainer(),!0;return!1}function Ba(N,P){const W=N.GetCurrentSol();if(W.IsSelectAll()){W._SetSelectAll(!1);W.ClearArrays();var aa=N.GetInstances();for(let ca=0,ia=aa.length;ca<ia;++ca){var ea=aa[ca];ea.GetUID()===P?W._PushElseInstance(ea):
W._PushInstance(ea)}N.ApplySolToContainer();return!!W._GetOwnInstances().length}aa=W._GetOwnInstances();ea=0;for(let ca=0,ia=aa.length;ca<ia;++ca){const oa=aa[ca];aa[ea]=oa;oa.GetUID()===P?W._PushElseInstance(oa):++ea}e.truncateArray(aa,ea);N.ApplySolToContainer();return!!aa.length}function Ca(){this._runtime.DestroyInstance(this._inst)}function Ja(){return!0}function Pa(){return!0}function Qa(N,P){this.GetInstance().SetInstanceVariableValue(N,P)}function Da(N,P){const W=this.GetInstance(),aa=W.GetInstanceVariableValue(N);
"number"===typeof aa&&"number"!==typeof P?P=parseFloat(P):"string"===typeof aa&&"string"!==typeof P&&(P=P.toString());W.SetInstanceVariableValue(N,aa+P)}function Bb(N,P){const W=this.GetInstance(),aa=W.GetInstanceVariableValue(N);"number"===typeof aa&&("number"!==typeof P&&(P=parseFloat(P)),W.SetInstanceVariableValue(N,aa-P))}function Cb(N,P){this.GetInstance().SetInstanceVariableValue(N,P?1:0)}function Ib(N){const P=this.GetInstance();P.SetInstanceVariableValue(N,0===P.GetInstanceVariableValue(N)?
1:0)}function Jb(N){let P;try{P=JSON.parse(N)}catch(W){console.error("Failed to load from JSON string: ",W);return}N=this.GetInstance();N._OnBeforeLoad("state");N.LoadFromJson(P,"state")}function Kb(){return JSON.stringify(this.GetInstance().SaveToJson("state"))}function Lb(){return this.GetInstance().GetObjectClass().GetName()}function Mb(){const N=this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass();let P=N.GetInstanceCount();for(const W of this._runtime.instancesPendingCreateForObjectClass(N))++P;
return P}function Nb(){return this._runtime.GetCurrentEventStackFrame().GetExpressionObjectClass().GetCurrentSol().GetInstances().length}function Ob(){return this._inst.GetIID()}function Pb(){return this._inst.GetUID()}e.AddCommonACEs=function(N,P){const W=N[1],aa=N[4],ea=N[5],ca=N[6],ia=N[7],oa=N[8],ja=N[10],wa=N[11],Ka=N[12],Oa=N[13],Za=N[14],La=N[15],la=P.Cnds,da=P.Acts,pa=P.Exps;N[3]&&(la.CompareX=a,la.CompareY=d,la.IsOnScreen=c,la.IsOutsideLayout=f,la.PickDistance=h,da.SetX=g,da.SetY=l,da.SetPos=
m,da.SetPosToObject=u,da.MoveForward=w,da.MoveAtAngle=q,pa.X=t,pa.Y=p,pa.dt=r);aa&&(la.CompareWidth=x,la.CompareHeight=y,da.SetWidth=D,da.SetHeight=G,da.SetSize=A,pa.Width=F,pa.Height=J,pa.BBoxLeft=B,pa.BBoxTop=I,pa.BBoxRight=L,pa.BBoxBottom=Q);ea&&(la.AngleWithin=S,la.IsClockwiseFrom=U,la.IsBetweenAngles=V,da.SetAngle=Z,da.RotateClockwise=ma,da.RotateCounterclockwise=va,da.RotateTowardAngle=Na,da.RotateTowardPosition=Ea,da.SetTowardPosition=Ia,pa.Angle=Ma);ca&&(la.IsVisible=ya,la.CompareOpacity=
Fa,da.SetVisible=na,da.SetOpacity=Va,da.SetDefaultColor=xa,pa.Opacity=bb,pa.ColorValue=Ga);ia&&(la.IsOnLayer=Xa,la.PickTopBottom=ob,la.CompareZElevation=pb,da.MoveToTop=cb,da.MoveToBottom=qb,da.MoveToLayer=rb,da.ZMoveToObject=sb,da.SetZElevation=tb,pa.LayerNumber=ub,pa.LayerName=vb,pa.ZIndex=wb,pa.ZElevation=db,pa.TotalZElevation=xb);oa&&(da.SetEffectEnabled=yb,da.SetEffectParam=zb);Oa&&(la.HasParent=lb,la.HasChildren=mb,la.PickParent=nb,la.PickChildren=$a,la.PickNthChild=k,la.CompareChildCount=n,
da.AddChild=v,da.RemoveChild=z,da.RemoveFromParent=C,pa.ChildCount=E);Za&&(da.SetMeshSize=H,da.SetMeshPoint=K,pa.MeshColumns=M,pa.MeshRows=O);ja&&(la.IsVisible=ya,da.SetVisible=R,da.SetCSSStyle=T,da.SetElemAttribute=Y,da.RemoveElemAttribute=X);wa&&(la.IsFocused=ba,da.SetFocus=fa,da.SetBlur=ha);Ka&&(la.IsEnabled=ka,da.SetEnabled=qa);La&&(la.OnCollision=Fb,la.IsOverlapping=Hb,la.IsOverlappingOffset=kb,P.FinishCollisionCondition=Eb);W||(la.CompareInstanceVar=ta,la.IsBoolInstanceVarSet=ua,la.PickInstVarHiLow=
ra,la.PickByUID=za,da.SetInstanceVar=Qa,da.AddInstanceVar=Da,da.SubInstanceVar=Bb,da.SetBoolInstanceVar=Cb,da.ToggleBoolInstanceVar=Ib,la.OnCreated=Ja,la.OnDestroyed=Pa,da.Destroy=Ca,da.LoadFromJsonString||(da.LoadFromJsonString=Jb),pa.AsJSON||(pa.AsJSON=Kb),pa.Count=Mb,pa.PickedCount=Nb,pa.IID=Ob,pa.UID=Pb,pa.ObjectTypeName=Lb)}}
{"use strict";const e=self.C3;e.ScheduledWait=class extends e.DefendedBase{constructor(b){super();this._eventSheetManager=b;this._type="";this._time=-1;this._signalTag="";this._isSignalled=!1;this._event=null;this._actIndex=0;this._solModifiers=[];this._sols=new Map;this._callingFunctionBlock=null;this._asyncId=-1;this._functionInnerLocalVars=this._functionParameters=null;this._shouldRelease=!1}Release(){this._type="";this._time=-1;this._signalTag="";this._functionInnerLocalVars=this._functionParameters=
this._callingFunctionBlock=this._event=null;this._asyncId=-1;e.clearArray(this._solModifiers);for(const b of this._sols.values())b.Release();this._sols.clear()}_Init(){var b=this._eventSheetManager,a=b.GetRuntime().GetAllObjectClasses();const d=b.GetCurrentEventStackFrame();this._event=d.GetCurrentEvent();this._actIndex=d.GetActionIndex()+1;if(b=b.FindFirstFunctionBlockParent(this._event))this._callingFunctionBlock=b,this._functionParameters=b.CaptureFunctionParameters(),this._functionInnerLocalVars=
b._GetAllInnerLocalVariables().map(c=>c.GetValue()),b.IsAsync()&&(this._asyncId=b.PauseCurrentAsyncFunction());for(const c of a)if(a=c.GetCurrentSol(),!a.IsSelectAll()||this._event.HasSolModifier(c))this._solModifiers.push(c),this._sols.set(c,e.New(e.SolState,a))}InitTimer(b){this._type="timer";this._Init();this._time=this._eventSheetManager.GetRuntime().GetGameTime()+b}InitSignal(b){this._type="signal";this._Init();this._signalTag=b.toLowerCase()}InitPromise(b){this._type="promise";this._Init();
b.then(()=>this.SetSignalled()).catch(a=>{console.warn("[C3 runtime] Promise rejected in 'Wait for previous actions to complete': ",a);this.SetSignalled()})}IsTimer(){return"timer"===this._type}IsSignal(){return"signal"===this._type}IsPromise(){return"promise"===this._type}GetSignalTag(){return this._signalTag}IsSignalled(){return this._isSignalled}SetSignalled(){this._isSignalled=!0}_ShouldRun(){return this.IsTimer()?this._time<=this._eventSheetManager.GetRuntime().GetGameTime():this.IsSignalled()}_RestoreState(b){b._Restore(this._event,
this._actIndex);for(const [a,d]of this._sols.entries())b=a.GetCurrentSol(),d._Restore(b);if(b=this._callingFunctionBlock)b.SetFunctionParameters(this._functionParameters),b._GetAllInnerLocalVariables().map((a,d)=>a.SetValue(this._functionInnerLocalVars[d])),b.IsAsync()&&b.ResumeAsyncFunction(this._asyncId)}_Run(b){this._RestoreState(b);this._event._ResumeActionsAndSubEvents(b);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);
this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}async _DebugRun(b){this._RestoreState(b);for(const a of this._event._DebugResumeActionsAndSubEvents(b))await this._eventSheetManager.GetRuntime().DebugBreak(a);this._callingFunctionBlock&&this._callingFunctionBlock.IsAsync()&&this._callingFunctionBlock.MaybeFinishAsyncFunctionCall(this._asyncId);this._eventSheetManager.ClearSol(this._solModifiers);this._shouldRelease=!0}ShouldRelease(){return this._shouldRelease}RemoveInstances(b){for(const a of this._sols.values())a.RemoveInstances(b)}_SaveToJson(){const b=
{},a={t:this._time,st:this._signalTag,s:this._isSignalled,ev:this._event.GetSID(),sm:this._solModifiers.map(d=>d.GetSID()),sols:b};this._event._HasActionIndex(this._actIndex)&&(a.act=this._event.GetActionAt(this._actIndex).GetSID());for(const [d,c]of this._sols)b[d.GetSID().toString()]=c._SaveToJson();return a}static _CreateFromJson(b,a){const d=b.GetRuntime();var c=b.GetEventBlockBySID(a.ev);if(!c)return null;let f=0;if(a.hasOwnProperty("act")){var h=b.GetActionBySID(a.act);if(!h)return null;f=h.GetIndex()}h=
e.New(e.ScheduledWait,b);h._time=a.t;h._type=-1===h._time?"signal":"timer";h._signalTag=a.st;h._isSignalled=a.s;h._event=c;h._actIndex=f;for(var g of a.sm)(c=d.GetObjectClassBySID(g))&&h._solModifiers.push(c);for(const [l,m]of Object.entries(a.sols))if(a=parseInt(l,10),a=d.GetObjectClassBySID(a))g=e.New(e.SolState,null),g._LoadFromJson(b,m),h._sols.set(a,g);return h}}}
{"use strict";const e=self.C3;e.SolState=class extends e.DefendedBase{constructor(b){super();this._objectClass=null;this._isSelectAll=!0;this._instances=[];b&&(this._objectClass=b.GetObjectClass(),this._isSelectAll=b.IsSelectAll(),e.shallowAssignArray(this._instances,b._GetOwnInstances()))}Release(){this._objectClass=null;e.clearArray(this._instances)}_Restore(b){b._SetSelectAll(this._isSelectAll);e.shallowAssignArray(b._GetOwnInstances(),this._instances)}RemoveInstances(b){e.arrayRemoveAllInSet(this._instances,
b)}_SaveToJson(){return{sa:this._isSelectAll,insts:this._instances.map(b=>b.GetUID())}}_LoadFromJson(b,a){b=b.GetRuntime();this._isSelectAll=!!a.sa;e.clearArray(this._instances);for(const d of a.insts)(a=b.GetInstanceByUID(d))&&this._instances.push(a)}}}
{"use strict";const e=self.C3;function b(a,d){let c=a.get(d);c||(c=new Map,a.set(d,c));return c}e.SDKPluginBase=class extends e.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._isSingleGlobal=!!a.isSingleGlobal;this._isWorldType=!!a.isWorld;this._isRotatable=!!a.isRotatable;this._mustPredraw=!!a.mustPredraw;this._hasEffects=!!a.hasEffects;this._supportsSceneGraph=!!a.supportsSceneGraph;this._supportsMesh=!!a.supportsMesh;this._singleGlobalObjectClass=null;this._boundACEMethodCache=
new Map;this._boundACEMethodCache_1param=new Map;this._boundACEMethodCache_2params=new Map;this._boundACEMethodCache_3params=new Map}Release(){this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}IsSingleGlobal(){return this._isSingleGlobal}IsWorldType(){return this._isWorldType}IsRotatable(){return this._isRotatable}MustPreDraw(){return this._mustPredraw}HasEffects(){return this._hasEffects}SupportsSceneGraph(){return this._supportsSceneGraph}SupportsMesh(){return this._supportsMesh}_GetBoundACEMethod(a,
d){if(!d)throw Error("missing 'this' binding");let c=this._boundACEMethodCache.get(a);if(c)return c;c=a.bind(d);this._boundACEMethodCache.set(a,c);return c}_GetBoundACEMethod_1param(a,d,c){if(!d)throw Error("missing 'this' binding");const f=b(this._boundACEMethodCache_1param,a);let h=f.get(c);if(h)return h;h=a.bind(d,c);f.set(c,h);return h}_GetBoundACEMethod_2params(a,d,c,f){if(!d)throw Error("missing 'this' binding");var h=b(this._boundACEMethodCache_2params,a);h=b(h,c);let g=h.get(f);if(g)return g;
g=a.bind(d,c,f);h.set(f,g);return g}_GetBoundACEMethod_3params(a,d,c,f,h){if(!d)throw Error("missing 'this' binding");var g=b(this._boundACEMethodCache_3params,a);g=b(g,c);g=b(g,f);let l=g.get(h);if(l)return l;l=a.bind(d,c,f,h);g.set(h,l);return l}_SetSingleGlobalObjectClass(a){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");this._singleGlobalObjectClass=a}GetSingleGlobalObjectClass(){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");return this._singleGlobalObjectClass}GetSingleGlobalInstance(){if(!this.IsSingleGlobal())throw Error("must be single-global plugin");
return this._singleGlobalObjectClass.GetSingleGlobalInstance()}}}
{"use strict";const e=self.C3;e.SDKDOMPluginBase=class extends e.SDKPluginBase{constructor(b,a){super(b);this._domComponentId=a;this._nextElementId=0;this._instMap=new Map;this.AddElementMessageHandler("elem-focused",d=>d._OnElemFocused());this.AddElementMessageHandler("elem-blurred",d=>{d&&d._OnElemBlurred()})}Release(){super.Release()}_AddElement(b){const a=this._nextElementId++;this._instMap.set(a,b);return a}_RemoveElement(b){this._instMap.delete(b)}AddElementMessageHandler(b,a){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,
b,d=>{const c=this._instMap.get(d.elementId);a(c,d)})}}}{"use strict";const e=self.C3;e.SDKTypeBase=class extends e.DefendedBase{constructor(b){super();this._objectClass=b;this._runtime=b.GetRuntime();this._plugin=b.GetPlugin()}Release(){this._plugin=this._runtime=this._objectClass=null}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetImageInfo(){return this._objectClass.GetImageInfo()}FinishCondition(b){}LoadTextures(b){}ReleaseTextures(){}OnDynamicTextureLoadComplete(){}PreloadTexturesWithInstances(b){}LoadTilemapData(){}GetScriptInterfaceClass(){return null}}}
{"use strict";const e=self.C3;e.SDKInstanceBase=class extends e.DefendedBase{constructor(b,a){super();this._inst=b;this._domComponentId=a;this._runtime=b.GetRuntime();this._objectClass=this._inst.GetObjectClass();this._sdkType=this._objectClass.GetSdkType();this._tick2Func=this._tickFunc=null;this._isTicking2=this._isTicking=!1;this._disposables=null;this._wasReleased=!1}Release(){this._wasReleased=!0;this._StopTicking();this._StopTicking2();this._tick2Func=this._tickFunc=null;this._disposables&&
(this._disposables.Release(),this._disposables=null);this._sdkType=this._objectClass=this._runtime=this._inst=null}WasReleased(){return this._wasReleased}GetInstance(){return this._inst}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetPlugin(){return this._sdkType.GetPlugin()}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._inst.GetInterfaceClass()}Trigger(b){return this._runtime.Trigger(b,this._inst,null)}DebugTrigger(b){return this._runtime.DebugTrigger(b,
this._inst,null)}TriggerAsync(b){return this._runtime.TriggerAsync(b,this._inst,null)}FastTrigger(b,a){return this._runtime.FastTrigger(b,this._inst,a)}DebugFastTrigger(b,a){return this._runtime.DebugFastTrigger(b,this._inst,a)}ScheduleTriggers(b){return this._runtime.ScheduleTriggers(b)}AddDOMMessageHandler(b,a){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,b,a)}AddDOMMessageHandlers(b){for(const [a,d]of b)this.AddDOMMessageHandler(a,d)}PostToDOM(b,a){this._runtime.PostComponentMessageToDOM(this._domComponentId,
b,a)}PostToDOMAsync(b,a){return this._runtime.PostComponentMessageToDOMAsync(this._domComponentId,b,a)}_PostToDOMMaybeSync(b,a){if(this._runtime.IsInWorker())this.PostToDOM(b,a);else return window.c3_runtimeInterface._OnMessageFromRuntime({type:"event",component:this._domComponentId,handler:b,data:a,responseId:null})}Tick(){}Tick2(){}_StartTicking(){this._isTicking||(this._tickFunc||(this._tickFunc=()=>this.Tick()),this._runtime.Dispatcher().addEventListener("tick",this._tickFunc),this._isTicking=
!0)}_StopTicking(){this._isTicking&&(this._runtime.Dispatcher().removeEventListener("tick",this._tickFunc),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){this._isTicking2||(this._tick2Func||(this._tick2Func=()=>this.Tick2()),this._runtime.Dispatcher().addEventListener("tick2",this._tick2Func),this._isTicking2=!0)}_StopTicking2(){this._isTicking2&&(this._runtime.Dispatcher().removeEventListener("tick2",this._tick2Func),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}GetDebuggerProperties(){return[]}SaveToJson(){return null}LoadFromJson(b){}GetPropertyValueByIndex(b){}SetPropertyValueByIndex(b,
a){}OffsetPropertyValueByIndex(b,a){if(0!==a){var d=this.GetPropertyValueByIndex(b);if("number"!==typeof d)throw Error("expected number");this.SetPropertyValueByIndex(b,d+a)}}SetPropertyColorOffsetValueByIndex(b,a,d,c){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(b,a,d){const c=this.GetScriptInterface();b=e.New(e.Event,b,a);b.instance=c;d&&Object.assign(b,d);c.dispatchEvent(b)}}}
{"use strict";const e=self.C3;e.SDKWorldInstanceBase=class extends e.SDKInstanceBase{constructor(b,a){super(b,a);this._worldInfo=b.GetWorldInfo();this._webglcontextrestored_handler=this._webglcontextlost_handler=null}Release(){if(this._webglcontextlost_handler){const b=this._runtime.Dispatcher();b.removeEventListener("webglcontextlost",this._webglcontextlost_handler);b.removeEventListener("webglcontextrestored",this._webglcontextrestored_handler);this._webglcontextrestored_handler=this._webglcontextlost_handler=
null}this._worldInfo=null;super.Release()}HandleWebGLContextLoss(){if(!this._webglcontextlost_handler){this._webglcontextlost_handler=()=>this.OnWebGLContextLost();this._webglcontextrestored_handler=()=>this.OnWebGLContextRestored();var b=this._runtime.Dispatcher();b.addEventListener("webglcontextlost",this._webglcontextlost_handler);b.addEventListener("webglcontextrestored",this._webglcontextrestored_handler)}}OnWebGLContextLost(){}OnWebGLContextRestored(){}GetWorldInfo(){return this._worldInfo}IsOriginalSizeKnown(){return!1}GetOriginalWidth(){if(!this.IsOriginalSizeKnown())throw Error("original size not known");
const b=this.GetCurrentImageInfo();if(b)return b.GetWidth()}GetOriginalHeight(){if(!this.IsOriginalSizeKnown())throw Error("original size not known");const b=this.GetCurrentImageInfo();if(b)return b.GetHeight()}GetCurrentImageInfo(){return null}GetCurrentSurfaceSize(){var b=this.GetCurrentImageInfo();return b&&(b=b.GetTexture())?[b.GetWidth(),b.GetHeight()]:[100,100]}GetCurrentTexRect(){const b=this.GetCurrentImageInfo();return b?b.GetTexRect():null}GetCurrentTexQuad(){const b=this.GetCurrentImageInfo();
return b?b.GetTexQuad():null}IsCurrentTexRotated(){const b=this.GetCurrentImageInfo();return b?b.IsRotated():!1}GetImagePoint(b){b=this._inst.GetWorldInfo();return[b.GetX(),b.GetY()]}LoadTilemapData(b,a,d){}TestPointOverlapTile(b,a){}RendersToOwnZPlane(){return!0}}}
{"use strict";const e=self.C3,b=e.New(e.Rect);e.SDKDOMInstanceBase=class extends e.SDKWorldInstanceBase{constructor(a,d){super(a,d);this._elementId=this.GetPlugin()._AddElement(this);this._isElementShowing=!0;this._autoFontSize=this._elemHasFocus=!1;this._lastRect=e.New(e.Rect,0,0,-1,-1);a=this._runtime.GetCanvasManager();this._lastWindowWidth=a.GetLastWidth();this._lastWindowHeight=a.GetLastHeight();this._isPendingUpdateState=!1;this._StartTicking()}Release(){this.GetPlugin()._RemoveElement(this._elementId);
this.PostToDOMElement("destroy");this._elementId=-1;super.Release()}_GetElementInDOMMode(){if(this._runtime.IsInWorker())throw Error("not valid in worker mode");return this._PostToDOMElementMaybeSync("get-element")}PostToDOMElement(a,d){d||(d={});d.elementId=this._elementId;this.PostToDOM(a,d)}_PostToDOMElementMaybeSync(a,d){d||(d={});d.elementId=this._elementId;return this._PostToDOMMaybeSync(a,d)}PostToDOMElementAsync(a,d){d||(d={});d.elementId=this._elementId;return this.PostToDOMAsync(a,d)}CreateElement(a){a||
(a={});const d=this.GetWorldInfo().IsVisible();a.elementId=this._elementId;a.isVisible=d;Object.assign(a,this.GetElementState());this._isElementShowing=!!a.isVisible;this._PostToDOMMaybeSync("create",a);this._UpdatePosition(!0)}SetElementVisible(a){a=!!a;this._isElementShowing!==a&&(this._isElementShowing=a,this.PostToDOMElement("set-visible",{isVisible:a}))}Tick(){this._UpdatePosition(!1)}_ShouldPreserveElement(){const a=this._runtime.GetCanvasManager().GetFullscreenMode();return"Android"===e.Platform.OS&&
("scale-inner"===a||"scale-outer"===a||"crop"===a)}_UpdatePosition(a){var d=this.GetWorldInfo();const c=d.GetLayer();var f=d.GetX(),h=d.GetY();let [g,l]=c.LayerToCanvasCss(f,h),[m,u]=c.LayerToCanvasCss(f+d.GetWidth(),h+d.GetHeight());f=this._runtime.GetCanvasManager();h=f.GetCssWidth();const w=f.GetCssHeight();if(d.IsVisible()&&c.IsVisible()){if(!this._ShouldPreserveElement()){if(0>=m||0>=u||g>=h||l>=w){this.SetElementVisible(!1);return}1>g&&(g=1);1>l&&(l=1);m>=h&&(m=h-1);u>=w&&(u=w-1)}b.set(g,l,
m,u);d=f.GetLastWidth();h=f.GetLastHeight();!a&&b.equals(this._lastRect)&&this._lastWindowWidth===d&&this._lastWindowHeight===h?this.SetElementVisible(!0):(this._lastRect.copy(b),this._lastWindowWidth=d,this._lastWindowHeight=h,this.SetElementVisible(!0),a=null,this._autoFontSize&&(a=c.GetDisplayScale()-.2),this.PostToDOMElement("update-position",{left:Math.round(this._lastRect.getLeft())+f.GetCanvasClientX(),top:Math.round(this._lastRect.getTop())+f.GetCanvasClientY(),width:Math.round(this._lastRect.width()),
height:Math.round(this._lastRect.height()),fontSize:a}))}else this.SetElementVisible(!1)}FocusElement(){this._PostToDOMElementMaybeSync("focus",{focus:!0})}BlurElement(){this._PostToDOMElementMaybeSync("focus",{focus:!1})}_OnElemFocused(){this._elemHasFocus=!0}_OnElemBlurred(){this._elemHasFocus=!1}IsElementFocused(){return this._elemHasFocus}SetElementCSSStyle(a,d){this.PostToDOMElement("set-css-style",{prop:e.CSSToCamelCase(a),val:d})}SetElementAttribute(a,d){this.PostToDOMElement("set-attribute",
{name:a,val:d})}RemoveElementAttribute(a){this.PostToDOMElement("remove-attribute",{name:a})}UpdateElementState(){this._isPendingUpdateState||(this._isPendingUpdateState=!0,Promise.resolve().then(()=>{this._isPendingUpdateState=!1;this.PostToDOMElement("update-state",this.GetElementState())}))}GetElementState(){}GetElementId(){return this._elementId}}}
{"use strict";const e=self.C3,b=self.IBehavior;e.SDKBehaviorBase=class extends e.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._myObjectClasses=e.New(e.ArraySet);this._myInstances=e.New(e.ArraySet);this._iBehavior=null;this._scriptInterfaceClass=a.scriptInterfaceClass||null}Release(){this._myInstances.Release();this._myObjectClasses.Release();this._runtime=null}GetRuntime(){return this._runtime}OnCreate(){}_AddObjectClass(a){this._myObjectClasses.Add(a)}GetObjectClasses(){return this._myObjectClasses.GetArray()}_AddInstance(a){this._myInstances.Add(a)}_RemoveInstance(a){this._myInstances.Delete(a)}GetInstances(){return this._myInstances.GetArray()}GetIBehavior(){if(null===
this._iBehavior){const a=this._scriptInterfaceClass;if(a){if(this._iBehavior=new a(this),!(this._iBehavior instanceof b))throw new TypeError("script interface class must derive from IBehavior");}else this._iBehavior=new b(this)}return this._iBehavior}}}
{"use strict";const e=self.C3;e.SDKBehaviorTypeBase=class extends e.DefendedBase{constructor(b){super();this._runtime=b.GetRuntime();this._behaviorType=b;this._objectClass=b.GetObjectClass();this._behavior=b.GetBehavior();this._behavior._AddObjectClass(this._objectClass)}Release(){this._behavior=this._objectClass=this._behaviorType=this._runtime=null}GetBehaviorType(){return this._behaviorType}GetObjectClass(){return this._objectClass}GetRuntime(){return this._runtime}GetBehavior(){return this._behavior}}}
{"use strict";const e=self.C3;e.SDKBehaviorInstanceBase=class extends e.DefendedBase{constructor(b,a){super();this._behInst=b;this._domComponentId=a;this._inst=b.GetObjectInstance();this._runtime=b.GetRuntime();this._behaviorType=b.GetBehaviorType();this._sdkType=this._behaviorType.GetSdkType();this._isPostTicking=this._isTicking2=this._isTicking=!1;this._disposables=null}Release(){this._StopTicking();this._StopTicking2();this._StopPostTicking();this._disposables&&(this._disposables.Release(),this._disposables=
null);this._sdkType=this._behaviorType=this._runtime=this._inst=this._behInst=null}GetBehavior(){return this._behaviorType.GetBehavior()}GetBehaviorInstance(){return this._behInst}GetObjectInstance(){return this._inst}GetObjectClass(){return this._inst.GetObjectClass()}GetWorldInfo(){return this._inst.GetWorldInfo()}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetSdkType(){return this._sdkType}GetScriptInterface(){return this._behInst.GetScriptInterface()}Trigger(b){return this._runtime.Trigger(b,
this._inst,this._behaviorType)}DebugTrigger(b){return this._runtime.DebugTrigger(b,this._inst,this._behaviorType)}TriggerAsync(b){return this._runtime.TriggerAsync(b,this._inst,this._behaviorType)}PostCreate(){}Tick(){}Tick2(){}PostTick(){}_StartTicking(){this._isTicking||(this._runtime._AddBehInstToTick(this),this._isTicking=!0)}_StopTicking(){this._isTicking&&(this._runtime._RemoveBehInstToTick(this),this._isTicking=!1)}IsTicking(){return this._isTicking}_StartTicking2(){this._isTicking2||(this._runtime._AddBehInstToTick2(this),
this._isTicking2=!0)}_StopTicking2(){this._isTicking2&&(this._runtime._RemoveBehInstToTick2(this),this._isTicking2=!1)}IsTicking2(){return this._isTicking2}_StartPostTicking(){this._isPostTicking||(this._runtime._AddBehInstToPostTick(this),this._isPostTicking=!0)}_StopPostTicking(){this._isPostTicking&&(this._runtime._RemoveBehInstToPostTick(this),this._isPostTicking=!1)}IsPostTicking(){return this._isPostTicking}GetDebuggerProperties(){return[]}AddDOMMessageHandler(b,a){this._runtime.AddDOMComponentMessageHandler(this._domComponentId,
b,a)}OnSpriteFrameChanged(b,a){}SaveToJson(){return null}LoadFromJson(b){}GetPropertyValueByIndex(b){}SetPropertyValueByIndex(b,a){}OffsetPropertyValueByIndex(b,a){if(0!==a){var d=this.GetPropertyValueByIndex(b);if("number"!==typeof d)throw Error("expected number");this.SetPropertyValueByIndex(b,d+a)}}SetPropertyColorOffsetValueByIndex(b,a,d,c){}CallAction(b,...a){b.call(this,...a)}CallExpression(b,...a){return b.call(this,...a)}GetScriptInterfaceClass(){return null}DispatchScriptEvent(b,a,d){const c=
this.GetScriptInterface();b=e.New(e.Event,b,a);b.behaviorInstance=c;b.instance=c.instance;d&&Object.assign(b,d);c.dispatchEvent(b)}}}
{"use strict";const e=self.C3;e.Plugins={};e.Behaviors={};e.PluginManager=class extends e.DefendedBase{constructor(b){super();this._runtime=b;this._allPlugins=[];this._pluginsByCtor=new Map;this._systemPlugin=null;this._allBehaviors=[];this._behaviorsByCtor=new Map;this._jumpthruBehavior=this._solidBehavior=null}CreatePlugin(b){const a=this._runtime.GetObjectReference(b[0]);if(!a)throw Error("missing plugin");e.AddCommonACEs(b,a);b=e.New(a,{runtime:this._runtime,isSingleGlobal:b[1],isWorld:b[2],isRotatable:b[5],
hasEffects:b[8],mustPredraw:b[9],supportsSceneGraph:b[13],supportsMesh:b[14]});b.OnCreate();this._allPlugins.push(b);this._pluginsByCtor.set(a,b)}CreateSystemPlugin(){this._systemPlugin=e.New(e.Plugins.System,{runtime:this._runtime,isSingleGlobal:!0});this._systemPlugin.OnCreate()}CreateBehavior(b){b=this._runtime.GetObjectReference(b[1]);if(!b)throw Error("missing behavior");const a=e.New(b,{runtime:this._runtime});a.OnCreate();this._allBehaviors.push(a);this._behaviorsByCtor.set(b,a);!this._solidBehavior&&
e.Behaviors.solid&&a instanceof e.Behaviors.solid?this._solidBehavior=a:!this._jumpthruBehavior&&e.Behaviors.jumpthru&&a instanceof e.Behaviors.jumpthru&&(this._jumpthruBehavior=a)}GetPluginByConstructorFunction(b){return this._pluginsByCtor.get(b)||null}HasBehaviorByConstructorFunction(b){return this._behaviorsByCtor.has(b)}GetBehaviorByConstructorFunction(b){return this._behaviorsByCtor.get(b)||null}GetSystemPlugin(){return this._systemPlugin}GetSolidBehavior(){return this._solidBehavior}GetJumpthruBehavior(){return this._jumpthruBehavior}}}
{"use strict";const e=self.C3,b=new Set;e.ImageInfo=class extends e.DefendedBase{constructor(){super();this._url="";this._height=this._width=this._offsetY=this._offsetX=this._size=0;this._hasMetaData=this._isRotated=!1;this._imageAsset=null;this._textureState="";this._rcTex=e.New(e.Rect);this._quadTex=e.New(e.Quad);this._iImageInfo=new self.IImageInfo(this);b.add(this)}Release(){this.ReleaseTexture();this._imageAsset=null;b.delete(this)}static OnWebGLContextLost(){for(const a of b)a._textureState=
"",a._rcTex.set(0,0,0,0),a._quadTex.setFromRect(a._rcTex)}LoadData(a){this._url=a[0];this._size=a[1];this._offsetX=a[2];this._offsetY=a[3];this._width=a[4];this._height=a[5];this._isRotated=a[6];this._hasMetaData=!0}LoadDynamicAsset(a,d){if(this._imageAsset)throw Error("already loaded asset");this._url=d;const c={};e.IsAbsoluteURL(d)&&(c.loadPolicy="remote");this.LoadAsset(a,c);return this._imageAsset.Load()}ReplaceWith(a){if(a===this)throw Error("cannot replace with self");this.ReleaseTexture();
this._url=a._url;this._size=a._size;this._offsetX=a._offsetX;this._offsetY=a._offsetY;this._width=a._width;this._height=a._height;this._isRotated=a._isRotated;this._hasMetaData=a._hasMetaData;this._imageAsset=a._imageAsset;this._textureState=a._textureState;this._rcTex=a._rcTex;this._quadTex=a._quadTex}GetURL(){return this._url}GetSize(){return this._size}GetOffsetX(){return this._offsetX}GetOffsetY(){return this._offsetY}IsRotated(){return this._isRotated}GetWidth(){return this._width}GetHeight(){return this._height}GetSheetWidth(){return this._imageAsset.GetWidth()}GetSheetHeight(){return this._imageAsset.GetHeight()}LoadAsset(a,
d){if(this._imageAsset)throw Error("already got asset");d=Object.assign({},d,{url:this.GetURL(),size:this.GetSize()});this._imageAsset=a.LoadImage(d)}IsLoaded(){return this._imageAsset&&this._imageAsset.IsLoaded()}async LoadStaticTexture(a,d){if(!this._imageAsset)throw Error("no asset");if(this._textureState)throw Error("already loaded texture");this._textureState="loading";a=await this._imageAsset.LoadStaticTexture(a,d);if(!a)return this._textureState="",null;this._textureState="loaded";this._hasMetaData||
(this._width=a.GetWidth(),this._height=a.GetHeight(),this._hasMetaData=!0);this._rcTex.set(this._offsetX,this._offsetY,this._offsetX+(this._isRotated?this._height:this._width),this._offsetY+(this._isRotated?this._width:this._height));this._rcTex.divide(a.GetWidth(),a.GetHeight());this._quadTex.setFromRect(this._rcTex);this._isRotated&&this._quadTex.rotatePointsAnticlockwise();return a}ReleaseTexture(){this._textureState&&(this._imageAsset&&this._imageAsset.ReleaseTexture(),this._textureState="",this._rcTex.set(0,
0,0,0),this._quadTex.setFromRect(this._rcTex))}GetTexture(){return this._imageAsset?this._imageAsset.GetTexture():null}GetTexRect(){return this._rcTex}GetTexQuad(){return this._quadTex}GetIImageInfo(){return this._iImageInfo}async ExtractImageToCanvas(){const a=await this._imageAsset.LoadToDrawable(),d=e.CreateCanvas(this._width,this._height);d.getContext("2d").drawImage(a,this._offsetX,this._offsetY,this._width,this._height,0,0,this._width,this._height);return d}}}
{"use strict";const e=self.C3;e.AnimationInfo=class extends e.DefendedBase{constructor(b){super();this._name=b[0];this._speed=b[1];this._isLooping=!!b[2];this._repeatCount=b[3];this._repeatTo=b[4];this._isPingPong=!!b[5];this._sid=b[6];this._frames=b[7].map(a=>e.New(e.AnimationFrameInfo,a));this._iAnimation=new self.IAnimation(this)}Release(){for(const b of this._frames)b.Release();e.clearArray(this._frames)}LoadAllAssets(b){for(const a of this._frames)a.GetImageInfo().LoadAsset(b)}LoadAllTextures(b,
a){return Promise.all(this._frames.map(d=>d.GetImageInfo().LoadStaticTexture(b,a)))}ReleaseAllTextures(){for(const b of this._frames)b.GetImageInfo().ReleaseTexture()}GetName(){return this._name}GetSID(){return this._sid}GetFrameCount(){return this._frames.length}GetFrames(){return this._frames}GetFrameAt(b){b=Math.floor(b);if(0>b||b>=this._frames.length)throw new RangeError("invalid frame");return this._frames[b]}GetSpeed(){return this._speed}IsLooping(){return this._isLooping}GetRepeatCount(){return this._repeatCount}GetRepeatTo(){return this._repeatTo}IsPingPong(){return this._isPingPong}GetIAnimation(){return this._iAnimation}}}
{"use strict";const e=self.C3;e.AnimationFrameInfo=class extends e.DefendedBase{constructor(b){super();this._imageInfo=e.New(e.ImageInfo);this._imageInfo.LoadData(b);this._duration=b[7];this._origin=e.New(e.Vector2,b[8],b[9]);this._imagePoints=b[10].map(a=>e.New(e.ImagePoint,this,a));this._imagePointsByName=new Map;for(const a of this._imagePoints)this._imagePointsByName.set(a.GetName().toLowerCase(),a);this._collisionPoly=null;b=b[11];6<=b.length&&(this._collisionPoly=e.New(e.CollisionPoly,b));this._iAnimationFrame=
new self.IAnimationFrame(this)}Release(){this._collisionPoly&&(this._collisionPoly.Release(),this._collisionPoly=null);this._imageInfo.Release();this._imageInfo=null}GetImageInfo(){return this._imageInfo}GetDuration(){return this._duration}GetOriginX(){return this._origin.getX()}GetOriginY(){return this._origin.getY()}GetCollisionPoly(){return this._collisionPoly}GetImagePointByName(b){return this._imagePointsByName.get(b.toLowerCase())||null}GetImagePointByIndex(b){b=Math.floor(b);return 0>b||b>=
this._imagePoints.length?null:this._imagePoints[b]}GetImagePointCount(){return this._imagePoints.length}GetIAnimationFrame(){return this._iAnimationFrame}}}{"use strict";const e=self.C3;e.ImagePoint=class extends e.DefendedBase{constructor(b,a){super();this._afi=b;this._name=a[0];this._pos=e.New(e.Vector2,a[1],a[2])}Release(){}GetName(){return this._name}GetX(){return this._pos.getX()}GetY(){return this._pos.getY()}GetVec2(){return this._pos}}}
{"use strict";const e=self.C3,b=self.C3Debugger,a=self.IObjectClass;e.ObjectClass=class extends e.DefendedBase{constructor(d,c,f){super();const h=d.GetObjectReference(f[1]);this._runtime=d;this._plugin=d.GetPluginManager().GetPluginByConstructorFunction(h);this._sdkType=null;this._instSdkCtor=h.Instance;this._index=c;this._sid=f[11];this._name=f[0];this._jsPropName=this._runtime.GetJsPropName(f[14]);this._isGlobal=!!f[9];this._isFamily=!!f[2];this._isOnLoaderLayout=!!f[10];this._instVars=f[3].map(g=>
({sid:g[0],type:g[1],name:g[2],jsPropName:d.GetJsPropName(g[3])}));this._behaviorsCount=f[4];this._effectsCount=f[5];this._isWorldType=this._plugin.IsWorldType();this._effectList=null;this._collisionGrid=e.New(e.SparseGrid,d.GetOriginalViewportWidth(),d.GetOriginalViewportHeight());this._anyCollisionCellChanged=!0;this._anyInstanceParallaxed=!1;this._familyMembersSet=this._familyMembers=null;this._familyIndex=-1;this._familyEffectMap=this._familyBehaviorMap=this._familyInstVarMap=this._familiesSet=
this._families=null;this._isInContainer=!1;this._container=null;this._behaviorTypes=f[8].map(g=>e.BehaviorType.Create(this,g));this._behaviorTypesIncludingInherited=[];this._behaviorsByName=new Map;this._behaviorNameToIndex=new Map;this._usedBehaviorCtors=new Set;this._solStack=e.New(e.SolStack,this);this._defaultInstanceData=null;this._defaultLayerIndex=0;this._isContained=!1;this._animationsBySid=this._animationsByName=this._animations=this._imageInfo=this._container=null;this._textureRefCount=
0;this._savedData=new Map;this._unsavedData=new Map;this._instances=[];this._iidsStale=!0;this._plugin.HasEffects()&&(this._effectList=e.New(e.EffectList,this,f[12]));f[6]&&(this._imageInfo=e.New(e.ImageInfo),this._imageInfo.LoadData(f[6]));if(f[7]){this._animations=f[7].map(g=>e.New(e.AnimationInfo,g));this._animationsByName=new Map;this._animationsBySid=new Map;for(const g of this._animations)this._animationsByName.set(g.GetName().toLowerCase(),g),this._animationsBySid.set(g.GetSID(),g)}this._isFamily?
(this._familyMembers=[],this._familyMembersSet=new Set,this._familyIndex=this._runtime._GetNextFamilyIndex()):(this._families=[],this._familiesSet=new Set,this._familyInstVarMap=[],this._familyBehaviorMap=[],this._familyEffectMap=[]);this._sdkType=e.New(h.Type,this,f[15]);this._instanceUserScriptClass=this._iObjectClass=null;this._userScriptDispatcher=e.New(e.Event.Dispatcher);if(c=this._sdkType.GetScriptInterfaceClass()){if(this._iObjectClass=new c(this),!(this._iObjectClass instanceof a))throw new TypeError("script interface class must derive from IObjectClass");
}else this._iObjectClass=new a(this);f[13]&&(c=f[13])&&this._sdkType.LoadTilemapData(c[0],c[1],c[2]);this._runtime.UsesLoaderLayout()&&!this._isFamily&&!this._isOnLoaderLayout&&this._isWorldType||this.OnCreate();this._plugin.IsSingleGlobal()&&(this._plugin._SetSingleGlobalObjectClass(this),this._CreateSingleGlobalInstance(f))}static Create(d,c,f){return e.New(e.ObjectClass,d,c,f)}Release(){this._imageInfo&&(this._imageInfo.Release(),this._imageInfo=null);if(this._animations){for(const d of this._animations)d.Release();
e.clearArray(this._animations);this._animationsByName.clear();this._animationsBySid.clear()}this._solStack.Release();this._solStack=null;this._savedData.clear();this._unsavedData.clear();this._runtime=this._container=null}_LoadFamily(d){for(let c=1,f=d.length;c<f;++c){const h=this._runtime.GetObjectClassByIndex(d[c]);this._familyMembers.push(h);this._familyMembersSet.add(h);h._families.push(this);h._familiesSet.add(this)}}_SetContainer(d){this._isInContainer=!0;this._container=d}IsInContainer(){return this._isInContainer}GetContainer(){return this._container}_OnAfterCreate(){var d=
0;if(!this._isFamily)for(var c of this._families)for(var f of c.GetBehaviorTypes()){const l=f.GetName().toLowerCase();this._behaviorsByName.set(l,f);this._behaviorNameToIndex.set(l,d);this._behaviorTypesIncludingInherited.push(f);++d}for(var h of this.GetBehaviorTypes())c=h.GetName().toLowerCase(),this._behaviorsByName.set(c,h),this._behaviorNameToIndex.set(c,d),this._behaviorTypesIncludingInherited.push(h),++d;for(var g of this._behaviorTypesIncludingInherited)this._usedBehaviorCtors.add(g.GetBehavior().constructor);
if(!this._isFamily&&this._families.length){d=this._runtime.GetFamilyCount();e.extendArray(this._familyInstVarMap,d,0);e.extendArray(this._familyBehaviorMap,d,0);e.extendArray(this._familyEffectMap,d,0);d=[];c=g=h=0;for(const l of this._families)if(f=l.GetFamilyIndex(),this._familyInstVarMap[f]=h,h+=l.GetInstanceVariablesCount(),this._familyBehaviorMap[f]=g,g+=l.GetBehaviorTypesCount(),this._familyEffectMap[f]=c,c+=l.GetEffectTypesCount(),(f=l.GetEffectList())&&this._effectList)for(const m of f.GetAllEffectTypes())d.push(m.Clone(this._effectList));
this._effectList&&this._effectList.PrependEffectTypes(d)}}_CreateSingleGlobalInstance(d){const c=this._runtime._GetNewUID(),f=e.New(e.Instance,{runtime:this._runtime,objectType:this,uid:c});f._CreateSdkInstance(d[16],[]);this._runtime._MapInstanceByUID(c,f);this._instances.push(f)}GetSdkType(){return this._sdkType}IsOnLoaderLayout(){return this._isOnLoaderLayout}OnCreate(){this._isFamily||this._sdkType.OnCreate()}HasLoadedTextures(){return 0<this._textureRefCount}LoadTextures(d){if(this._isFamily)return Promise.resolve();
this._textureRefCount++;return 1===this._textureRefCount?this._sdkType.LoadTextures(d)||Promise.resolve():Promise.resolve()}ReleaseTextures(){if(!this._isFamily){this._textureRefCount--;if(0>this._textureRefCount)throw Error("released textures too many times");0===this._textureRefCount&&this._sdkType.ReleaseTextures()}}OnDynamicTextureLoadComplete(){if(this._isFamily)throw Error("not applicable to family");this._sdkType.OnDynamicTextureLoadComplete()}PreloadTexturesWithInstances(d){return this._isFamily?
Promise.resolve():this._sdkType.PreloadTexturesWithInstances(d)}GetRuntime(){return this._runtime}GetPlugin(){return this._plugin}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetJsPropName(){return this._jsPropName}GetIndex(){return this._index}GetSID(){return this._sid}IsFamily(){return this._isFamily}IsGlobal(){return this._isGlobal}IsWorldType(){return this._isWorldType}GetFamilyIndex(){return this._familyIndex}GetBehaviorTypes(){return this._behaviorTypes}GetBehaviorTypesCount(){return this._behaviorsCount}UsesBehaviorByCtor(d){return d&&
this._usedBehaviorCtors.has(d)}GetInstanceVariablesCount(){return this._instVars.length}GetInstanceVariableSIDs(){return this._instVars.map(d=>d.sid)}GetInstanceVariableIndexBySID(d){return this._instVars.findIndex(c=>c.sid===d)}GetInstanceVariableIndexByName(d){return this._instVars.findIndex(c=>c.name===d)}_GetAllInstanceVariableNames(){return this._instVars.map(d=>d.name)}_GetAllInstanceVariableJsPropNames(){return this._instVars.map(d=>d.jsPropName)}GetInstanceVariableType(d){d=Math.floor(d);
if(0>d||d>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[d].type}GetInstanceVariableName(d){d=Math.floor(d);if(0>d||d>=this._instVars.length)throw new RangeError("invalid instance variable index");return this._instVars[d].name}GetEffectTypesCount(){return this._effectsCount}GetBehaviorTypesIncludingInherited(){return this._behaviorTypesIncludingInherited}GetBehaviorTypeByName(d){return this._behaviorsByName.get(d.toLowerCase())||null}GetBehaviorIndexByName(d){d=
this._behaviorNameToIndex.get(d.toLowerCase());return"undefined"===typeof d?-1:d}GetEffectList(){return this._effectList}HasEffects(){return this._plugin.HasEffects()}UsesEffects(){return this._effectList&&this._effectList.HasAnyEffectType()}GetSolStack(){return this._solStack}GetCurrentSol(){return this._solStack.GetCurrentSol()}GetImageInfo(){return this._imageInfo}SetDefaultInstanceData(d){this._defaultInstanceData=d}GetDefaultInstanceData(){return this._defaultInstanceData}_SetDefaultLayerIndex(d){this._defaultLayerIndex=
d}GetDefaultLayerIndex(){return this._defaultLayerIndex}GetAnimations(){return this._animations}GetAnimationCount(){return this._animations.length}GetFamilies(){return this._families}BelongsToFamily(d){return this._familiesSet.has(d)}GetFamilyMembers(){return this._familyMembers}FamilyHasMember(d){return this._familyMembersSet.has(d)}GetFamilyBehaviorOffset(d){return this._familyBehaviorMap[d]}GetFamilyInstanceVariableOffset(d){return this._familyInstVarMap[d]}GetAnimationByName(d){if(!this._animations)throw Error("no animations");
return this._animationsByName.get(d.toLowerCase())||null}GetAnimationBySID(d){if(!this._animations)throw Error("no animations");return this._animationsBySid.get(d)||null}GetFirstAnimationFrame(){if(!this._animations)throw Error("no animations");return this._animations[0].GetFrameAt(0)}GetDefaultInstanceSize(){if(this._animations){const d=this.GetFirstAnimationFrame().GetImageInfo();return[d.GetWidth(),d.GetHeight()]}return this._imageInfo?[this._imageInfo.GetWidth(),this._imageInfo.GetHeight()]:[100,
100]}GetSingleGlobalInstance(){if(!this._plugin.IsSingleGlobal())throw Error("not a single-global plugin");return this._instances[0]}GetInstances(){return this._instances}*instances(){yield*this._instances}*instancesIncludingPendingCreate(){yield*this._instances;for(const d of this._runtime._GetInstancesPendingCreate())d.GetObjectClass()===this&&(yield d)}GetInstanceCount(){return this._instances.length}_AddInstance(d){this._instances.push(d)}_SetIIDsStale(){this._iidsStale=!0}_UpdateIIDs(){if(this._iidsStale&&
!this._isFamily){var d=this._instances,c=0;for(let f=d.length;c<f;++c)d[c]._SetIID(c);d=this._runtime._GetInstancesPendingCreate();for(const f of d)f.GetObjectClass()===this&&f._SetIID(c++);this._iidsStale=!1}}GetInstanceByIID(d){var c=this._instances;if(d<c.length)return c[d];d-=c.length;c=this._runtime._GetInstancesPendingCreate();for(const f of c)if(f.GetObjectClass()===this){if(0===d)return f;--d}return null}GetFirstPicked(d){if(d&&d.IsInContainer()&&d.GetObjectClass()!==this)for(const c of d.siblings())if(c.GetObjectClass()===
this)return c;d=this.GetCurrentSol().GetInstances();return d.length?d[0]:null}GetPairedInstance(d){const c=this.GetCurrentSol().GetInstances();return 0<c.length?c[d.GetIID()%c.length]:null}*allCorrespondingInstances(d,c){const f=this.GetCurrentSol().GetInstances();var h=f.length;const g=c.GetCurrentSol(),l=c.GetCurrentSol().GetInstances(),m=l.length;var u=d.GetIID();if(c.IsFamily()||!g.IsSelectAll())u=l.indexOf(d);d=Math.ceil(h/m);h%=m;0===h||u<h?(u*=d,h=d):(u=h*d+(u-h)*(d-1),h=d-1);for(let w=u,q=
u+h;w<q;++w)yield f[w]}FinishCondition(d){this._sdkType.FinishCondition(d)}ApplySolToContainer(){if(this._isInContainer&&!this._isFamily){this._UpdateIIDs();var d=this.GetCurrentSol(),c=d._GetOwnInstances(),f=d.IsSelectAll(),h=this._runtime.GetCurrentEventStackFrame();h=h&&h.GetCurrentEvent()&&h.GetCurrentEvent().IsOrBlock();for(const m of this._container.objectTypes())if(m!==this){m._UpdateIIDs();var g=m.GetCurrentSol();g._SetSelectAll(f);if(!f){var l=g._GetOwnInstances();e.clearArray(l);for(const u of c)l.push(m.GetInstanceByIID(u.GetIID()));
if(h){l=d._GetOwnElseInstances();g=g._GetOwnElseInstances();e.clearArray(g);for(const u of l)g.push(m.GetInstanceByIID(u.GetIID()))}}}}}_TruncateContainerSols(d,c){for(const f of this.GetContainer().objectTypes()){const h=f.GetCurrentSol();d?e.truncateArray(h._GetOwnElseInstances(),c):e.truncateArray(h._GetOwnInstances(),c)}}_GetCollisionCellGrid(){return this._collisionGrid}_SetAnyCollisionCellChanged(d){this._anyCollisionCellChanged=!!d}_SetAnyInstanceParallaxed(d){this._anyInstanceParallaxed=!!d}IsAnyInstanceParallaxed(){return this._anyInstanceParallaxed}_UpdateAllCollisionCells(){if(this._anyCollisionCellChanged&&
this._isWorldType){for(const d of this._instances)d.GetWorldInfo()._UpdateCollisionCell();for(const d of this._runtime._GetInstancesPendingCreate())d.GetObjectClass()===this&&d.GetWorldInfo()._UpdateCollisionCell();this._anyCollisionCellChanged=!1}}GetSavedDataMap(){this._savedData||(this._savedData=new Map);return this._savedData}GetUnsavedDataMap(){this._unsavedData||(this._unsavedData=new Map);return this._unsavedData}HasSolidBehavior(){return this.UsesBehaviorByCtor(e.Behaviors.solid)}HasJumpthruBehavior(){return this.UsesBehaviorByCtor(e.Behaviors.jumpthru)}HasNoSaveBehavior(){return this.UsesBehaviorByCtor(e.Behaviors.NoSave)}HasPersistBehavior(){return this.UsesBehaviorByCtor(e.Behaviors.Persist)}_SaveToJson(){const d=
{instances:this._instances.map(c=>c.SaveToJson())};this._savedData&&this._savedData.size&&(d.ex=e.ToSuperJSON(this._savedData));return d}_LoadFromJson(d){this._savedData&&(this._savedData.clear(),this._savedData=null);var c=d.ex;c&&(this._savedData=e.FromSuperJSON(c));c=this._instances;d=d.instances;for(let f=0,h=Math.min(c.length,d.length);f<h;++f)c[f].LoadFromJson(d[f]);for(let f=d.length,h=c.length;f<h;++f)this._runtime.DestroyInstance(c[f]);for(let f=c.length,h=d.length;f<h;++f){c=d[f];let g=
null;if(this.IsWorldType()&&(g=this._runtime.GetMainRunningLayout().GetLayerBySID(c.w.l),!g))continue;this._runtime.CreateInstanceFromData(this._defaultInstanceData||this,g,!1,0,0,!0).LoadFromJson(c)}this._SetIIDsStale()}GetIObjectClass(){return this._iObjectClass}UserScriptDispatcher(){return this._userScriptDispatcher}_GetUserScriptInstanceClass(){return this._instanceUserScriptClass}_SetUserScriptInstanceClass(d){this._instanceUserScriptClass=d}DispatchUserScriptEvent(d){var c=this._runtime;(c=
c.IsDebug()&&!c.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(d);c&&b.AddScriptTime()}}}
{"use strict";const e=self.C3;e.Container=class extends e.DefendedBase{constructor(b,a){super();this._runtime=b;this._objectTypes=a;for(const d of this._objectTypes)d._SetContainer(this)}Release(){this._runtime=null}GetRuntime(){return this._runtime}GetObjectTypes(){return this._objectTypes}objectTypes(){return this._objectTypes}HasAnyWorldType(){return this._objectTypes.some(b=>b.IsWorldType())}}}
{"use strict";const e=self.C3,b=self.C3Debugger,a=self.IInstance,d=[];let c=0;const f=new WeakMap,h=new WeakMap;e.Instance=class extends e.DefendedBase{constructor(g){super();this._runtime=g.runtime;this._objectType=g.objectType;this._iScriptInterface=this._sdkInst=this._worldInfo=null;this._iid=0;this._uid=g.uid;this._puid=c++;this._flags=0;this._behaviorInstances=this._instVarValues=d;var l=this._objectType.GetBehaviorTypesIncludingInherited();0<l.length&&(this._behaviorInstances=l.map((m,u)=>e.New(e.BehaviorInstance,
{runtime:this._runtime,behaviorType:m,instance:this,index:u})));this._siblings=this._objectType.IsInContainer()?[]:null;this._timeScale=-1;this._dispatcher=null;l=this.GetPlugin();l.MustPreDraw()&&(this._flags|=4);if(l.IsWorldType())if(this._worldInfo=e.New(e.WorldInfo,this,g.layer),g.worldData)this._worldInfo.Init(g.worldData);else{this._worldInfo.InitNoData();const [m,u]=this._objectType.GetDefaultInstanceSize();this._worldInfo.SetSize(m,u);this.GetObjectClass().UsesEffects()&&this._worldInfo.GetInstanceEffectList().LoadDefaultEffectParameters()}g.instVarData?
this._LoadInstanceVariableData(g.instVarData):this._LoadDefaultInstanceVariables()}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);if(0<this._behaviorInstances.length){for(var g of this._behaviorInstances)g.Release();e.clearArray(this._behaviorInstances)}this._sdkInst.Release();this._sdkInst=null;if(g=f.get(this))g.clear(),f.delete(this);if(g=h.get(this))g.clear(),h.delete(this);this._siblings&&e.clearArray(this._siblings);this._dispatcher&&(this._dispatcher.Release(),
this._dispatcher=null);this._objectType=this._runtime=null;0<this._instVarValues.length&&e.clearArray(this._instVarValues);this._worldInfo&&(this._worldInfo.Release(),this._worldInfo=null)}_LoadInstanceVariableData(g){0<g.length&&(this._instVarValues=[],e.shallowAssignArray(this._instVarValues,g))}_LoadDefaultInstanceVariables(){const g=this._objectType.GetInstanceVariablesCount();if(0!==g){this._instVarValues=[];var l=[0,0,""];for(let m=0;m<g;++m)this._instVarValues.push(l[this._objectType.GetInstanceVariableType(m)])}}_CreateSdkInstance(g,
l){if(this._sdkInst)throw Error("already got sdk instance");for(let m=0,u=this._behaviorInstances.length;m<u;++m)this._behaviorInstances[m]._CreateSdkInstance(l?l[m]:null);this._sdkInst=e.New(this._objectType.GetInstanceSdkCtor(),this,g);if(!(this._sdkInst instanceof e.SDKInstanceBase))throw Error("sdk type must derive from SDKInstanceBase");for(let m=0,u=this._behaviorInstances.length;m<u;++m)this._behaviorInstances[m].PostCreate();this._objectType._GetUserScriptInstanceClass()&&this._InitUserScriptInterface()}GetSdkInstance(){return this._sdkInst}GetWorldInfo(){return this._worldInfo}GetRuntime(){return this._runtime}GetTimeScale(){return this._timeScale}GetActiveTimeScale(){const g=
this._timeScale;return-1===g?this.GetRuntime().GetTimeScale():g}SetTimeScale(g){g=+g;if(0>g||!isFinite(g))g=0;this._timeScale=g}RestoreTimeScale(){this._timeScale=-1}Dispatcher(){this._dispatcher||(this._dispatcher=e.New(e.Event.Dispatcher));return this._dispatcher}Draw(g){this._sdkInst.Draw(g)}OnCreate(g){this._sdkInst.OnCreate(g)}_SetHasTilemap(){this._flags|=2}HasTilemap(){return 0!==(this._flags&2)}_MarkDestroyed(){this._flags|=1}IsDestroyed(){return 0!==(this._flags&1)}MustPreDraw(){return 0!==
(this._flags&4)}SetMustMitigateZFighting(){this._flags|=32}MustMitigateZFighting(){return 0!==(this._flags&32)}_IsSolidEnabled(){return 0!==(this._flags&8)}_SetSolidEnabled(g){this._flags=g?this._flags|8:this._flags&-9}_IsJumpthruEnabled(){return 0!==(this._flags&16)}_SetJumpthruEnabled(g){this._flags=g?this._flags|16:this._flags&-17}_IsDrawingWithEffects(){return 0!==(this._flags&64)}_SetIsDrawingWithEffects(g){this._flags=g?this._flags|64:this._flags&-65}SetFlag(g,l){g<<=16;this._flags=l?this._flags|
g:this._flags&~g}GetFlag(g){return 0!==(this._flags&g<<16)}GetCurrentImageInfo(){return this._sdkInst.GetCurrentImageInfo()}GetCurrentSurfaceSize(){return this._sdkInst.GetCurrentSurfaceSize()}GetCurrentTexRect(){return this._sdkInst.GetCurrentTexRect()}GetCurrentTexQuad(){return this._sdkInst.GetCurrentTexQuad()}IsCurrentTexRotated(){return this._sdkInst.IsCurrentTexRotated()}GetImagePoint(g){return this._sdkInst.GetImagePoint(g)}GetObjectClass(){return this._objectType}RendersToOwnZPlane(){return this._sdkInst.RendersToOwnZPlane()}BelongsToObjectClass(g){return g.IsFamily()?
g.FamilyHasMember(this.GetObjectClass()):this.GetObjectClass()===g}VerifySupportsSceneGraph(){if(!this.GetPlugin().SupportsSceneGraph())throw Error("object does not support scene graph");}HasParent(){return null!==this.GetParent()}GetParent(){var g=this.GetWorldInfo();return g?(g=g.GetParent())?g.GetInstance():null:null}GetTopParent(){var g=this.GetWorldInfo();return g?(g=g.GetTopParent())?g.GetInstance():null:null}*parents(){const g=this.GetWorldInfo();if(g)for(const l of g.parents())yield l.GetInstance()}HasChildren(){const g=
this.GetWorldInfo();return g?g.HasChildren():!1}GetChildren(){const g=this.GetWorldInfo();return g?g.GetChildren().map(l=>l.GetInstance()):[]}*children(){const g=this.GetWorldInfo();if(g)for(const l of g.children())yield l.GetInstance()}*allChildren(){const g=this.GetWorldInfo();if(g)for(const l of g.allChildren())yield l.GetInstance()}GetChildCount(){const g=this.GetWorldInfo();return g?g.GetChildCount():0}GetChildAt(g){const l=this.GetWorldInfo();return l?(g=l.GetChildAt(g))?g.GetInstance():null:
null}AddChild(g,l){this.VerifySupportsSceneGraph();g.VerifySupportsSceneGraph();this.GetWorldInfo().AddChild(g.GetWorldInfo(),l||{})}RemoveChild(g){const l=this.GetWorldInfo();l&&l.RemoveChild(g.GetWorldInfo())}GetDestroyWithParent(){const g=this.GetWorldInfo();return g?g.GetDestroyWithParent():!1}SetupInitialSceneGraphConnections(){var g=this.GetWorldInfo();if(g&&(g=g.GetSceneGraphChildrenExportData()))for(const l of g)if(g=this._runtime.GetInstanceByUID(l[2])){const m=l[3];this.AddChild(g,{transformX:!!(m>>
0&1),transformY:!!(m>>1&1),transformWidth:!!(m>>2&1),transformHeight:!!(m>>3&1),transformAngle:!!(m>>4&1),destroyWithParent:!!(m>>5&1),transformZElevation:!!(m>>6&1)})}}IsInContainer(){return null!==this._siblings}_AddSibling(g){this._siblings.push(g)}GetSiblings(){return this._siblings}HasSibling(g){return!!this.GetSibling(g)}GetSibling(g){const l=this.siblings();if(null===l||0===l.length)return!1;for(const m of l)if(m.GetObjectClass()===g)return m;return null}siblings(){return this._siblings}SetSiblingsSinglePicked(){for(const g of this.siblings())g.GetObjectClass().GetCurrentSol().SetSinglePicked(g)}_PushSiblingsToSolInstances(){for(const g of this.siblings())g.GetObjectClass().GetCurrentSol()._PushInstance(g)}_SetSiblingsToSolInstancesIndex(g){for(const l of this.siblings())l.GetObjectClass().GetCurrentSol()._GetOwnInstances()[g]=
l}_PushSiblingsToSolElseInstances(){for(const g of this.siblings())g.GetObjectClass().GetCurrentSol()._PushElseInstance(g)}_SetSiblingsToSolElseInstancesIndex(g){for(const l of this.siblings())l.GetObjectClass().GetCurrentSol()._GetOwnElseInstances()[g]=l}GetPlugin(){return this._objectType.GetPlugin()}_SetIID(g){this._iid=g}GetIID(){this._objectType._UpdateIIDs();return this._iid}GetUID(){return this._uid}GetPUID(){return this._puid}GetBehaviorInstances(){return this._behaviorInstances}GetBehaviorInstanceFromCtor(g){if(!g)return null;
for(const l of this._behaviorInstances)if(l.GetBehavior()instanceof g)return l;return null}GetBehaviorSdkInstanceFromCtor(g){return g?(g=this.GetBehaviorInstanceFromCtor(g))?g.GetSdkInstance():null:null}GetBehaviorIndexBySID(g){const l=this._behaviorInstances;for(let m=0,u=l.length;m<u;++m)if(l[m].GetBehaviorType().GetSID()===g)return m;return-1}GetAllInstanceVariableValues(){return this._instVarValues}_GetAllInstanceVariableNames(){return this._objectType._GetAllInstanceVariableNames()}GetInstanceVariableCount(){return this._instVarValues.length}GetInstanceVariableValue(g){g|=
0;const l=this._instVarValues;if(0>g||g>=l.length)throw new RangeError("invalid instance variable");return l[g]}_GetInstanceVariableValueUnchecked(g){return this._instVarValues[g]}_GetInstanceVariableTypedValue(g){const l=this._instVarValues[g];return 0===this._objectType.GetInstanceVariableType(g)?!!l:l}SetInstanceVariableValue(g,l){g|=0;const m=this._instVarValues;if(0>g||g>=m.length)throw new RangeError("invalid instance variable");switch(this._objectType.GetInstanceVariableType(g)){case 0:m[g]=
l?1:0;break;case 1:m[g]="number"===typeof l?l:parseFloat(l);break;case 2:m[g]="string"===typeof l?l:l.toString();break;default:throw Error("unknown instance variable type");}}SetInstanceVariableOffset(g,l){if(0!==l){g|=0;var m=this._instVarValues;if(0>g||g>=m.length)throw new RangeError("invalid instance variable");var u=m[g];if("number"===typeof u)m[g]="number"===typeof l?m[g]+l:m[g]+parseFloat(l);else{if("boolean"===typeof u)throw Error("can not set offset of boolean variable");if("string"===typeof u)throw Error("can not set offset of string variable");
throw Error("unknown instance variable type");}}}GetSavedDataMap(){let g=f.get(this);if(g)return g;g=new Map;f.set(this,g);return g}GetUnsavedDataMap(){let g=h.get(this);if(g)return g;g=new Map;h.set(this,g);return g}_HasAnyCreateDestroyHandler(g){const l=this.GetObjectClass();if(l.UserScriptDispatcher().HasAnyHandlerFor(g))return!0;for(const m of l.GetFamilies())if(m.UserScriptDispatcher().HasAnyHandlerFor(g))return!0;return this._runtime.UserScriptDispatcher().HasAnyHandlerFor(g)?!0:!1}_TriggerOnCreatedOnSelfAndRelated(){const g=
new Set;g.add(this);const l=this.GetWorldInfo();if(l&&l.HasChildren())for(const m of this.allChildren())if(g.add(m),m.IsInContainer())for(const u of m.siblings())g.add(u);if(this.IsInContainer())for(const m of this.siblings())g.add(m);for(const m of g.values())m._TriggerOnCreated()}_TriggerOnCreated(){if(this._HasAnyCreateDestroyHandler("instancecreate")){const g=this.GetObjectClass(),l=new e.Event("instancecreate");l.instance=this.GetInterfaceClass();g.DispatchUserScriptEvent(l);for(const m of g.GetFamilies())m.DispatchUserScriptEvent(l);
this._runtime.DispatchUserScriptEvent(l)}this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnCreated,this,null)}_TriggerOnDestroyed(){this._runtime.Trigger(this.GetPlugin().constructor.Cnds.OnDestroyed,this,null)}_FireDestroyedScriptEvents(g){if(this._iScriptInterface){var l=new e.Event("destroy");l.isEndingLayout=g;this.DispatchUserScriptEvent(l)}if(this._HasAnyCreateDestroyHandler("instancedestroy")){l=this.GetObjectClass();var m=new e.Event("instancedestroy");m.instance=this.GetInterfaceClass();
m.isEndingLayout=g;l.DispatchUserScriptEvent(m);for(const u of l.GetFamilies())u.DispatchUserScriptEvent(m);this._runtime.DispatchUserScriptEvent(m)}}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(g="full"){const l={};"full"===g?l.uid=this.GetUID():l.c3=!0;if("visual-state"!==g){var m=f.get(this);m&&m.size&&(l.ex=e.ToSuperJSON(m));-1!==this.GetTimeScale()&&(l.mts=this.GetTimeScale());if(0<this._objectType.GetInstanceVariablesCount()){m={};var u=this._objectType.GetInstanceVariableSIDs();
for(let w=0,q=this._instVarValues.length;w<q;++w)m[u[w].toString()]=this._instVarValues[w];l.ivs=m}if(this._behaviorInstances.length){m={};for(const w of this._behaviorInstances)(u=w.SaveToJson())&&(m[w.GetBehaviorType().GetSID().toString()]=u);l.behs=m}}this._worldInfo&&(l.w=this._worldInfo._SaveToJson(g));(g=this._sdkInst.SaveToJson())&&(l.data=g);return l}_OnBeforeLoad(g="full"){this._worldInfo&&this._worldInfo._OnBeforeLoad(g)}LoadFromJson(g,l="full"){if("full"===l)this._uid=g.uid;else if(!g.c3)return;
if("visual-state"!==l){var m=f.get(this);m&&(m.clear(),f.delete(this));if(m=g.ex)m=e.FromSuperJSON(m),f.set(this,m);this._timeScale=g.hasOwnProperty("mts")?g.mts:-1;if(m=g.ivs)for(const [q,t]of Object.entries(m))if(m=parseInt(q,10),m=this._objectType.GetInstanceVariableIndexBySID(m),!(0>m||m>=this._instVarValues.length)){var u=t;null===u&&(u=NaN);this._instVarValues[m]=u}}if(this.GetPlugin().IsWorldType()){m=g.w;var w=m.l;this._worldInfo.GetLayer().GetSID()!==w&&(u=this._worldInfo.GetLayer(),(w=u.GetLayout().GetLayerBySID(w))?
(this._worldInfo._SetLayer(w),u._RemoveInstance(this,!0),w._AddInstance(this,!0),w.SetZIndicesChanged(),this._worldInfo.SetBboxChanged()):"full"===l&&this._runtime.DestroyInstance(this));this._worldInfo._LoadFromJson(m,l)}if("visual-state"!==l&&(l=g.behs))for(const [q,t]of Object.entries(l))l=parseInt(q,10),l=this.GetBehaviorIndexBySID(l),0>l||l>=this._behaviorInstances.length||this._behaviorInstances[l].LoadFromJson(t);(g=g.data)&&this._sdkInst.LoadFromJson(g)}GetInterfaceClass(){return this._iScriptInterface||
this._InitUserScriptInterface()}_InitUserScriptInterface(){var g=this._worldInfo?self.IWorldInstance:a;const l=this._sdkInst.GetScriptInterfaceClass(),m=this._objectType._GetUserScriptInstanceClass(),u=m||l||g;a._Init(this);this._iScriptInterface=new u;a._Init(null);if(l&&!(this._iScriptInterface instanceof g))throw new TypeError(`script interface class '${l.name}' does not extend the right base class '${g.name}'`);if(m&&(g=l||g,!(this._iScriptInterface instanceof g)))throw new TypeError(`setInstanceClass(): class '${m.name}' does not extend the right base class '${g.name}'`);
return this._iScriptInterface}_GetInstVarsScriptDescriptor(g){if(0!==this._instVarValues.length){var l={},m=this._objectType._GetAllInstanceVariableJsPropNames();for(let u=0,w=m.length;u<w;++u)l[m[u]]={configurable:!1,enumerable:!0,get:e.Instance.prototype._GetInstanceVariableTypedValue.bind(this,u),set:e.Instance.prototype.SetInstanceVariableValue.bind(this,u)};l=Object.create(Object.prototype,l);g.instVars={value:l,writable:!1}}}_GetBehaviorsScriptDescriptor(g){var l=this._behaviorInstances;if(0!==
l.length){var m={};for(const u of l)m[u.GetBehaviorType().GetJsPropName()]={value:u.GetScriptInterface(),writable:!1};l=Object.create(Object.prototype,m);g.behaviors={value:l,writable:!1}}}DispatchUserScriptEvent(g){g.instance=this.GetInterfaceClass();var l=this._runtime;(l=l.IsDebug()&&!l.GetEventSheetManager().IsInEventEngine())&&b.StartMeasuringScriptTime();this.GetInterfaceClass().dispatchEvent(g);l&&b.AddScriptTime()}}}
{"use strict";const e=self.C3;e.SceneGraphInfo=class extends e.DefendedBase{constructor(b){super();this._owner=b;this._parent=null;this._children=[];this._startWidth=b.GetWidth();this._startHeight=b.GetHeight();this._startScaleY=this._startScaleX=1;this._parentStartAngle=0}Release(){this._parent=null;e.clearArray(this._children)}SetParent(b){this._parentStartAngle=(this._parent=b)?b.GetAngle():0}GetParent(){return this._parent}HasChildren(){return 0<this._children.length}GetChildren(){return this._children}GetStartScaleX(){return this._startScaleX}SetStartScaleX(b){this._startScaleX=
b}GetStartScaleY(){return this._startScaleY}SetStartScaleY(b){this._startScaleY=b}_GetStartWidth(){return this._startWidth}_GetStartHeight(){return this._startHeight}GetParentScaleX(){return this._owner.GetTransformWithParentWidth()?this._parent.GetWidth()/this._parent._GetSceneGraphInfo()._GetStartWidth():1}GetParentScaleY(){return this._owner.GetTransformWithParentHeight()?this._parent.GetHeight()/this._parent._GetSceneGraphInfo()._GetStartHeight():1}GetParentStartAngle(){return this._parentStartAngle}_SaveToJson(){return{sw:this._startWidth,
sh:this._startHeight,sx:this._startScaleX,sy:this._startScaleY,psa:this._parentStartAngle,c:this._children.map(b=>{let a="";b.GetTransformWithParentX()&&(a+="x");b.GetTransformWithParentY()&&(a+="y");b.GetTransformWithParentWidth()&&(a+="w");b.GetTransformWithParentHeight()&&(a+="h");b.GetTransformWithParentAngle()&&(a+="a");b.GetTransformWithParentZElevation()&&(a+="z");b.GetDestroyWithParent()&&(a+="d");return{uid:b.GetInstance().GetUID(),f:a}})}}_LoadFromJson(b){this._startWidth=b.sw;this._startHeight=
b.sh;this._startScaleX=b.sx;this._startScaleY=b.sy;this._parentStartAngle=b.psa}_OnAfterLoad(b){const a=this._owner,d=a.GetRuntime();for(const c of b.c){b=d.GetInstanceByUID(c.uid).GetWorldInfo();const f=c.f,h={};h.transformX=f.includes("x");h.transformY=f.includes("y");h.transformWidth=f.includes("w");h.transformHeight=f.includes("h");h.transformAngle=f.includes("a");h.transformZElevation=f.includes("z");h.destroyWithParent=f.includes("d");a.AddChild(b,h)}}}}
{"use strict";const e=self.C3,b=e.New(e.Rect),a=e.New(e.Quad),d=e.New(e.Event,"bboxchange",!1),c=e.New(e.Color,0,0,0,0),f=e.New(e.CollisionPoly),h=e.New(e.Color,1,1,1,1),g=e.New(e.Rect,0,0,-1,-1),l=e.New(e.Rect,0,0,-1,-1),m=new Set(["absolute","relative"]),u=[];let w=!0;const q=new WeakMap,t=new WeakMap;e.WorldInfo=class extends e.DefendedBase{constructor(p,r){super();this._inst=p;this._objectClass=p.GetObjectClass();this._runtime=p.GetRuntime();this._layer=r;this._zIndex=-1;this._flags=196635;this._objectClass.GetPlugin().IsRotatable()&&
(this._flags|=128);this._oy=this._ox=this._cosA=this._sinA=this._a=this._depth=this._h=this._w=this._zElevation=this._y=this._x=NaN;this._boundingBox=e.New(e.Rect);this._boundingQuad=e.New(e.Quad);this._collisionCells=l;this._renderCells=g;this._solidFilterTags=this._transformedPolyInfo=this._sourceCollisionPoly=null;this._colorPremultiplied=this._color=h;this._instanceEffectList=this._stateGroup=null;this._inst.GetObjectClass().UsesEffects()&&(this._instanceEffectList=e.New(e.InstanceEffectList,
this._inst,this));this._meshInfo=this._sceneGraphInfo=null}_MarkDestroyed(){this._flags|=256}Release(){this._stateGroup&&(this._runtime.GetRenderer().ReleaseStateGroup(this._stateGroup),this._stateGroup=null);this._sourceCollisionPoly=null;this._transformedPolyInfo&&(this._transformedPolyInfo.poly.Release(),this._transformedPolyInfo=null);this._solidFilterTags&&(this._solidFilterTags.clear(),this._solidFilterTags=null);this.ReleaseMesh();this.HasParent()&&this.GetParent().RemoveChild(this);if(this.HasChildren()){const p=
[...this.GetChildren()];for(const r of p)this.RemoveChild(r)}this._ReleaseSceneGraphInfo();this._layer=this._runtime=this._objectClass=this._inst=null}Init(p){w=!1;this.SetXY(p[0],p[1]);this.SetZElevation(p[2]);this.SetSize(p[3],p[4]);this._depth=0;this.IsRotatable()?this.SetAngle(p[6]):this._a=0;c.setFromJSON(p[7]);this._SetColor(c);this.SetOriginX(p[8]);this.SetOriginY(p[9]);this.SetBlendMode(p[10]);this._instanceEffectList&&this._instanceEffectList._LoadEffectParameters(p[12]);p[14]&&q.set(this,
{childrenData:p[14][1],zIndexData:p[14][2]});if(p[15]){var r=p[15];this.CreateMesh(r[0],r[1]);p=this.GetSourceMesh();r=r[2];for(let x=0,y=r.length;x<y;++x){const D=r[x];for(let G=0,A=D.length;G<A;++G){const F=D[G],J=p.GetMeshPointAt(G,x);J.SetX(F[0]);J.SetY(F[1]);J.SetZElevation(F[2]);J.SetU(F[3]);J.SetV(F[4])}}}w=!0;this._UpdateRendererStateGroup()}InitNoData(){this._sinA=this._a=this._depth=this._h=this._w=this._zElevation=this._y=this._x=0;this._cosA=1;this._oy=this._ox=0;this._UpdateRendererStateGroup()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetInstance(){return this._inst}_GetParentOffsetAngle(){return this.GetTransformWithParentAngle()?
this.GetParent().GetAngle()-this._sceneGraphInfo.GetParentStartAngle():0}SetX(p){p=+p;if(this.GetTransformWithParentX()){const r=this._sceneGraphInfo;p-=this.GetX();const x=-this._GetParentOffsetAngle();0===x?this._x+=p/r.GetParentScaleX():(this._x+=Math.cos(x)*p/r.GetParentScaleX(),this.GetTransformWithParentY()&&(this._y+=Math.sin(x)*p/r.GetParentScaleY()))}else this._x=p}OffsetX(p){p=+p;this.GetTransformWithParentX()?this.SetX(this.GetX()+p):this._x+=p}GetX(){if(this.GetTransformWithParentX()){let p=
this._x;const r=this._sceneGraphInfo,x=this.GetParent(),y=this._GetParentOffsetAngle();0===y?p*=r.GetParentScaleX():(p=p*r.GetParentScaleX()*Math.cos(y),this.GetTransformWithParentY()&&(p-=this._y*r.GetParentScaleY()*Math.sin(y)));return x.GetX()+p}return this._x}SetY(p){p=+p;if(this.GetTransformWithParentY()){const r=this._sceneGraphInfo;p-=this.GetY();const x=-this._GetParentOffsetAngle();0===x?this._y+=p/r.GetParentScaleY():(this.GetTransformWithParentX()&&(this._x-=Math.sin(x)*p/r.GetParentScaleX()),
this._y+=Math.cos(x)*p/r.GetParentScaleY())}else this._y=p}OffsetY(p){p=+p;this.GetTransformWithParentY()?this.SetY(this.GetY()+p):this._y+=p}GetY(){if(this.GetTransformWithParentY()){let p=this._y;const r=this._sceneGraphInfo,x=this.GetParent(),y=this._GetParentOffsetAngle();0===y?p*=r.GetParentScaleY():(p=p*r.GetParentScaleY()*Math.cos(y),this.GetTransformWithParentX()&&(p+=this._x*r.GetParentScaleX()*Math.sin(y)));return x.GetY()+p}return this._y}SetXY(p,r){p=+p;r=+r;if(this.GetTransformWithParentXOrY()){const y=
this.GetTransformWithParentX(),D=this.GetTransformWithParentY(),G=this._sceneGraphInfo,A=p-this.GetX(),F=r-this.GetY();var x=-this._GetParentOffsetAngle();if(0===x)this._x=y?this._x+A/G.GetParentScaleX():p,this._y=D?this._y+F/G.GetParentScaleY():r;else{const J=Math.sin(x);x=Math.cos(x);this._x=y?D?this._x+(x*A-J*F)/G.GetParentScaleX():this._x+x*A/G.GetParentScaleX():p;this._y=D?y?this._y+(J*A+x*F)/G.GetParentScaleY():this._y+x*F/G.GetParentScaleY():r}}else this._x=p,this._y=r}OffsetXY(p,r){p=+p;r=
+r;this.GetTransformWithParentXOrY()?this.SetXY(this.GetX()+p,this.GetY()+r):(this._x+=p,this._y+=r)}EqualsXY(p,r){return this.GetX()===p&&this.GetY()===r}SetZElevation(p){p=+p;this.GetTransformWithParentZElevation()&&(p-=this.GetParent().GetZElevation());this._zElevation!==p&&(this._zElevation=p,this._UpdateZElevation(),p=this.GetLayer(),0!==this._zElevation&&p._SetAnyInstanceZElevated(),p.SetZIndicesChanged())}_UpdateZElevation(){this._UpdateRendererStateGroup();if(this.HasChildren()){const p=this.GetChildren();
for(let r=0,x=p.length;r<x;r++){const y=p[r];y.GetTransformWithParentZElevation()&&y._UpdateZElevation()}}}OffsetZElevation(p){this.SetZElevation(this.GetZElevation()+p)}GetZElevation(){return this.GetTransformWithParentZElevation()?this.GetParent().GetZElevation()+this._zElevation:this._zElevation}GetTotalZElevation(){return this.GetLayer().GetZElevation()+this.GetZElevation()}SetWidth(p){p=+p;if(this.GetTransformWithParentWidth()){const r=this.GetWidth();this._w=0===r?1E-6:p/r*this._w}else this._w=
p}OffsetWidth(p){p=+p;this.GetTransformWithParentWidth()?this.SetWidth(this.GetWidth()+p):this._w+=p}GetWidth(){return this.GetTransformWithParentWidth()?this.GetParent().GetWidth()*this._w:this._w}SetHeight(p){p=+p;if(this.GetTransformWithParentHeight()){const r=this.GetHeight();this._h=0===r?1E-6:p/r*this._h}else this._h=p}OffsetHeight(p){p=+p;this.GetTransformWithParentHeight()?this.SetHeight(this.GetHeight()+p):this._h+=p}GetHeight(){return this.GetTransformWithParentHeight()?this.GetParent().GetHeight()*
this._h:this._h}SetSize(p,r){p=+p;r=+r;if(this.GetTransformWithParentWidth()){const x=this.GetWidth();this._w=0===x?1E-6:p/x*this._w}else this._w=p;this.GetTransformWithParentHeight()?(p=this.GetHeight(),this._h=0===p?1E-6:r/p*this._h):this._h=r}GetDepth(){return this._depth}SetDepth(p){if(0>p)throw new RangeError("invalid depth");this._depth=p}GetSceneGraphScale(){if(this.HasParent()){const p=this._sceneGraphInfo;return Math.min(p.GetParentScaleX(),p.GetParentScaleY())}return 1}IsRotatable(){return 0!==
(this._flags&128)}SetAngle(p){p=+p;this.IsRotatable()&&(this.GetTransformWithParentAngle()&&(p-=this.GetParent().GetAngle()),p=e.clampAngle(p),this._a!==p&&(this._a=p,this._MarkSinCosAngleChanged()))}OffsetAngle(p){p=+p;0!==p&&this.IsRotatable()&&(this._a=e.clampAngle(this._a+p),this._MarkSinCosAngleChanged())}_MarkSinCosAngleChanged(){this._flags|=262144;if(this.HasChildren()){const p=this.GetChildren();for(let r=0,x=p.length;r<x;r++)p[r]._MarkSinCosAngleChanged()}}GetAngle(){return this.GetTransformWithParentAngle()?
e.clampAngle(this.GetParent().GetAngle()+this._a):this._a}_MaybeUpdateSinCosAngle(){const p=this._flags;if(0!==(p&262144)){var r=this.GetAngle();this._sinA=Math.sin(r);this._cosA=Math.cos(r);this._flags=p&-262145}}GetSinAngle(){this._MaybeUpdateSinCosAngle();return this._sinA}GetCosAngle(){this._MaybeUpdateSinCosAngle();return this._cosA}SetOriginX(p){this._ox=+p}OffsetOriginX(p){this._ox+=+p}GetOriginX(){return this._ox}SetOriginY(p){this._oy=+p}OffsetOriginY(p){this._oy+=+p}GetOriginY(){return this._oy}_SetColor(p){this._color.equals(p)||
(this._color===h?(this._color=e.New(e.Color,p),this._colorPremultiplied=e.New(e.Color,p),this._colorPremultiplied.premultiply()):p.equalsRgba(1,1,1,1)?this._colorPremultiplied=this._color=h:(this._color.set(p),this._colorPremultiplied.set(p),this._colorPremultiplied.premultiply()),this._UpdateRendererStateGroup())}SetOpacity(p){p=e.clamp(+p,0,1);this._color.a!==p&&(c.copyRgb(this._color),c.a=p,this._SetColor(c))}OffsetOpacity(p){this.SetOpacity(this.GetOpacity()+p)}GetOpacity(){return this._color.a}SetUnpremultipliedColor(p){this._color.equalsIgnoringAlpha(p)||
(c.copyRgb(p),c.a=this._color.a,this._SetColor(c))}SetUnpremultipliedColorRGB(p,r,x){c.setRgb(p,r,x);this.SetUnpremultipliedColor(c)}OffsetUnpremultipliedColorRGB(p,r,x){if(0!==p||0!==r||0!==x)c.copyRgb(this._color),c.r+=p,c.g+=r,c.b+=x,this.SetUnpremultipliedColor(c)}GetUnpremultipliedColor(){return this._color}GetPremultipliedColor(){return this._colorPremultiplied}GetDestroyWithParent(){return 0!==(this._flags&512)}SetDestroyWithParent(p){this._SetFlag(512,p)}GetTransformWithParentX(){return 0!==
(this._flags&1024)}SetTransformWithParentX(p){this._SetFlag(1024,p)}GetTransformWithParentY(){return 0!==(this._flags&2048)}GetTransformWithParentXOrY(){return 0!==(this._flags&3072)}SetTransformWithParentY(p){this._SetFlag(2048,p)}GetTransformWithParentWidth(){return 0!==(this._flags&4096)}SetTransformWithParentWidth(p){this._SetFlag(4096,p)}GetTransformWithParentHeight(){return 0!==(this._flags&8192)}SetTransformWithParentHeight(p){this._SetFlag(8192,p)}GetTransformWithParentAngle(){return 0!==
(this._flags&16384)}SetTransformWithParentAngle(p){this._SetFlag(16384,p)}GetTransformWithParentZElevation(){return 0!==(this._flags&32768)}SetTransformWithParentZElevation(p){this._SetFlag(32768,p)}_ClearAllSceneGraphFlags(){this._flags&=-65025}AddChild(p,r){if(p!==this&&!p.HasParent()&&!this._HasChildRecursive(p)&&!this._HasAnyParent(p)){var x=p.GetX(),y=p.GetY(),D=p.GetWidth(),G=p.GetHeight(),A=p.GetAngle(),F=p.GetZElevation();p._SetParent(this);p.SetTransformWithParentX(r.transformX);p.SetTransformWithParentY(r.transformY);
p.SetTransformWithParentWidth(r.transformWidth);p.SetTransformWithParentHeight(r.transformHeight);p.SetTransformWithParentAngle(r.transformAngle);p.SetTransformWithParentZElevation(r.transformZElevation);p.SetDestroyWithParent(r.destroyWithParent);r.transformX&&(p._x=x-this.GetX(),r.transformWidth&&(p._x/=this.GetWidth()/this._sceneGraphInfo._GetStartWidth()));r.transformY&&(p._y=y-this.GetY(),r.transformHeight&&(p._y/=this.GetHeight()/this._sceneGraphInfo._GetStartHeight()));r.transformWidth&&(p._w=
D/this.GetWidth(),p._sceneGraphInfo.SetStartScaleX(p._w));r.transformHeight&&(p._h=G/this.GetHeight(),p._sceneGraphInfo.SetStartScaleY(p._h));r.transformAngle&&(p._a=A-this.GetAngle());r.transformZElevation&&(p._zElevation=F-this.GetZElevation());this._AddChildToSceneGraphInfo(p);this.SetBboxChanged()}}RemoveChild(p){if(p.GetParent()===this){var r=p.GetX(),x=p.GetY(),y=p.GetWidth(),D=p.GetHeight(),G=p.GetAngle(),A=p.GetZElevation();p._SetParent(null);p._ClearAllSceneGraphFlags();p.SetXY(r,x);p.SetSize(y,
D);p.SetAngle(G);p.SetZElevation(A);this._RemoveChildFromSceneGraphInfo(p);this.SetBboxChanged()}}_ResetAllSceneGraphState(){for(var p of this.children())this.RemoveChild(p);(p=this.GetParent())&&p.RemoveChild(this);this._ClearAllSceneGraphFlags()}HasParent(){return null!==this.GetParent()}GetParent(){const p=this._sceneGraphInfo;return null!==p?p.GetParent():null}GetTopParent(){let p=this;for(;p.HasParent();)p=p.GetParent();return p}*parents(){let p=this.GetParent();for(;p;)yield p,p=p.GetParent()}HasChild(p){return this.GetChildren().includes(p)}HasChildren(){const p=
this._sceneGraphInfo;return null!==p?p.HasChildren():!1}GetChildren(){const p=this._sceneGraphInfo;return null!==p?p.GetChildren():u}children(){return this.GetChildren()}*allChildren(){for(const p of this.children())yield p,yield*p.allChildren()}GetChildCount(){return this.GetChildren().length}GetChildAt(p){const r=this.GetChildren();p=Math.floor(+p);return 0>p||p>=r.length?null:r[p]}_CreateSceneGraphInfo(p){this._sceneGraphInfo||(this._sceneGraphInfo=e.New(e.SceneGraphInfo,this));p&&this._sceneGraphInfo.SetParent(p)}_GetSceneGraphInfo(){return this._sceneGraphInfo}_ReleaseSceneGraphInfo(){this._sceneGraphInfo&&
(this._sceneGraphInfo.Release(),this._sceneGraphInfo=null)}_SetParent(p){p?(p._CreateSceneGraphInfo(null),this._CreateSceneGraphInfo(p)):(this._sceneGraphInfo&&this._sceneGraphInfo.SetParent(null),this.HasChildren()||this._ReleaseSceneGraphInfo())}_HasAnyParent(p){if(!this.HasParent())return!1;const r=this.GetParent();return r===p?!0:r._HasAnyParent(p)}_HasChildRecursive(p){if(this.HasChild(p))return!0;for(const r of this.GetChildren())if(r._HasChildRecursive(p))return!0;return!1}_AddChildToSceneGraphInfo(p){this._sceneGraphInfo.GetChildren().push(p)}_RemoveChildFromSceneGraphInfo(p){const r=
this._sceneGraphInfo.GetChildren(),x=r.indexOf(p);-1!==x&&r.splice(x,1);0!==r.length||this.HasParent()||this._ReleaseSceneGraphInfo();p.HasChildren()||p._ReleaseSceneGraphInfo()}GetSceneGraphChildrenExportData(){const p=q.get(this);return p?p.childrenData:null}GetSceneGraphZIndexExportData(){const p=q.get(this);return p?p.zIndexData:NaN}GetSceneGraphZIndex(){const p=t.get(this);return e.IsFiniteNumber(p)?p:NaN}SetSceneGraphZIndex(p){t.set(this,p)}SetUsePointsShaderProgram(){this._SetFlag(524288,!0);
this._UpdateRendererStateGroup()}_UpdateRendererStateGroup(){if(w){var p=this._runtime.GetRenderer();this._stateGroup&&p.ReleaseStateGroup(this._stateGroup);var r=0!==(this._flags&524288)?p.GetPointsRenderingProgram()||"<point>":p.GetTextureFillShaderProgram()||"<default>";this._stateGroup=p.AcquireStateGroup(r,this.GetBlendMode(),this._colorPremultiplied,this.GetZElevation())}}GetRendererStateGroup(){return this._stateGroup}HasDefaultColor(){return this._color===h}SetBlendMode(p){p|=0;if(0>p||31<
p)throw new RangeError("invalid blend mode");this.GetBlendMode()!==p&&(this._flags=this._flags&-2080374785|p<<26,this._UpdateRendererStateGroup())}GetBlendMode(){return(this._flags&2080374784)>>26}_SetLayer(p){this._layer=p;0!==this.GetZElevation()&&this._layer._SetAnyInstanceZElevated()}GetLayer(){return this._layer}GetLayout(){return this.GetLayer().GetLayout()}_SetZIndex(p){this._zIndex=p|0}GetZIndex(){this._layer._UpdateZIndices();return this._zIndex}_GetLastCachedZIndex(){return this._zIndex}_SetFlag(p,
r){this._flags=r?this._flags|p:this._flags&~p}IsVisible(){return 0!==(this._flags&1)}SetVisible(p){this._SetFlag(1,p)}IsCollisionEnabled(){return 0!==(this._flags&8)}SetCollisionEnabled(p){p=!!p;this.IsCollisionEnabled()!==p&&(this._SetFlag(8,p),p?this.SetBboxChanged():this._RemoveFromCollisionCells())}SetSolidCollisionFilter(p,r){this._SetFlag(32,p);this._solidFilterTags&&this._solidFilterTags.clear();if(r.trim()){this._solidFilterTags||(this._solidFilterTags=new Set);for(const x of r.split(" "))x&&
this._solidFilterTags.add(x.toLowerCase())}else this._solidFilterTags=null}IsSolidCollisionAllowed(p){const r=0!==(this._flags&32),x=this._solidFilterTags;if(!p||!x)return!r;for(const y of x)if(p.has(y))return r;return!r}SetBboxChanged(){this._flags|=65554;this._objectClass._SetAnyCollisionCellChanged(!0);this._runtime.UpdateRender();this._layer.UsesRenderCells()&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),this._flags&=-3,this._UpdateRenderCell());0!==(this._flags&4)&&this._inst.Dispatcher().dispatchEvent(d);
if(null!==this._sceneGraphInfo){const p=this._sceneGraphInfo.GetChildren();for(let r=0,x=p.length;r<x;++r)p[r].SetBboxChanged()}}CalculateBbox(p,r,x){const y=this.GetX(),D=this.GetY(),G=this.GetWidth(),A=this.GetHeight(),F=this.GetAngle();p.setWH(y-this._ox*G,D-this._oy*A,G,A);x&&this.HasMesh()&&this._ExpandBboxForMesh(p);0===F?r.setFromRect(p):(p.offset(-y,-D),r.setFromRotatedRectPrecalc(p,this.GetSinAngle(),this.GetCosAngle()),r.offset(y,D),r.getBoundingBox(p));p.normalize()}_UpdateBbox(){const p=
this._flags;0!==(p&2)&&(this.CalculateBbox(this._boundingBox,this._boundingQuad,!0),this._flags=p&-3)}GetBoundingBox(){this._UpdateBbox();return this._boundingBox}GetBoundingQuad(){this._UpdateBbox();return this._boundingQuad}PixelRoundQuad(p){var r=this.GetX(),x=this.GetY();r=Math.round(r)-r;x=Math.round(x)-x;if(0===r&&0===x)return p;a.copy(p);a.offset(r,x);return a}OverwriteBoundingBox(p){this._boundingBox.copy(p);this._boundingQuad.setFromRect(this._boundingBox);this._flags&=-3;this._UpdateCollisionCell();
this._UpdateRenderCell()}SetBboxChangeEventEnabled(p){this._SetFlag(4,p)}IsBboxChangeEventEnabled(){return 0!==(this._flags&4)}IsInViewport(p,r,x){return r&&0!==this.GetDepth()?this.IsInViewport3D(this.GetLayer()._GetViewFrustum()):0===this.GetZElevation()||x?p.intersectsRect(this.GetBoundingBox()):this._IsInViewport_ZElevated()}_IsInViewport_ZElevated(){const p=this.GetLayer(),r=this.GetTotalZElevation();if(r>=p.GetCameraZ())return!1;p.GetViewportForZ(r,b);return b.intersectsRect(this.GetBoundingBox())}IsInViewport3D(p){var r=
this.GetBoundingBox();const x=r.getLeft(),y=r.getRight(),D=r.getTop();r=r.getBottom();const G=this.GetTotalZElevation(),A=G+this.GetDepth();return p.ContainsAABB(x,D,G,y,r,A)}_SetDrawBackFaceOnly(p){this._SetFlag(1048576,p)}_SetDrawNonBackFacesOnly(p){this._SetFlag(2097152,p)}IsDrawBackFaceOnly(){return 0!==(this._flags&1048576)}IsDrawNonBackFacesOnly(){return 0!==(this._flags&2097152)}SetSourceCollisionPoly(p){this._sourceCollisionPoly=p;this._DiscardTransformedCollisionPoly();this.HasMesh()&&(this._meshInfo.meshPoly=
null)}GetSourceCollisionPoly(){return this._sourceCollisionPoly}HasOwnCollisionPoly(){return null!==this._sourceCollisionPoly||this.HasMesh()}GetTransformedCollisionPoly(){return this._GetCustomTransformedCollisionPolyPrecalc(this.GetWidth(),this.GetHeight(),this.GetAngle(),this.GetSinAngle(),this.GetCosAngle())}GetCustomTransformedCollisionPoly(p,r,x){let y=0,D=1;0!==x&&(y=Math.sin(x),D=Math.cos(x));return this._GetCustomTransformedCollisionPolyPrecalc(p,r,x,y,D)}_GetCustomTransformedCollisionPolyPrecalc(p,
r,x,y,D){let G=this._transformedPolyInfo;null===G&&(this._transformedPolyInfo=G={poly:e.New(e.CollisionPoly),width:NaN,height:NaN,angle:NaN});const A=G.poly;if(G.width===p&&G.height===r&&G.angle===x)return A;const F=this._sourceCollisionPoly;if(this.HasMesh()){const J=this.GetOriginX(),B=this.GetOriginY(),I=this.GetSourceMesh();let L=this._meshInfo.meshPoly;L||(F?(f.copy(F),f.offset(J,B)):f.setDefaultPoints(),L=I.InsertPolyMeshVertices(f),this._meshInfo.meshPoly=L);I.TransformCollisionPoly(L,A);A.offset(-J,
-B);A.transformPrecalc(p,r,y,D)}else F?(A.copy(F),A.transformPrecalc(p,r,y,D)):A.setFromQuad(this.GetBoundingQuad(),-this.GetX(),-this.GetY());G.width=p;G.height=r;G.angle=x;return A}_DiscardTransformedCollisionPoly(){this.SetPhysicsBodyChanged(!0);const p=this._transformedPolyInfo;null!==p&&(p.width=NaN)}CreateMesh(p,r){p=Math.floor(p);r=Math.floor(r);if(!this.GetInstance().GetPlugin().SupportsMesh())throw Error("object does not support mesh");this.ReleaseMesh();this._meshInfo={sourceMesh:e.New(e.Gfx.Mesh,
p,r),transformedMesh:e.New(e.Gfx.Mesh,p,r),meshPoly:null}}HasMesh(){return null!==this._meshInfo}GetSourceMesh(){if(!this.HasMesh())throw Error("no mesh");return this._meshInfo.sourceMesh}GetTransformedMesh(){if(!this.HasMesh())throw Error("no mesh");return this._meshInfo.transformedMesh}SetMeshChanged(p){this._SetFlag(65536,p)}IsMeshChanged(){return 0!==(this._flags&65536)}SetPhysicsBodyChanged(p){this._SetFlag(131072,p)}IsPhysicsBodyChanged(){return 0!==(this._flags&131072)}_ExpandBboxForMesh(p){const r=
this._meshInfo.sourceMesh,x=Math.min(r.GetMinX(),0),y=Math.min(r.GetMinY(),0),D=Math.max(r.GetMaxX(),1),G=Math.max(r.GetMaxY(),1),A=p.width(),F=p.height();p.offsetLeft(x*A);p.offsetTop(y*F);p.offsetRight((D-1)*A);p.offsetBottom((G-1)*F);this._depth=r.GetMaxZ()}ReleaseMesh(){this._meshInfo&&(this._meshInfo.sourceMesh.Release(),this._meshInfo.transformedMesh.Release(),this._meshInfo=null,this._DiscardTransformedCollisionPoly())}SetMeshPoint(p,r,x){p=Math.floor(p);r=Math.floor(r);var y=x.mode||"absolute";
if(!m.has(y))throw Error("invalid mode");y="relative"===y;let D=x.x,G=x.y;const A=x.zElevation;let F="number"===typeof x.u?x.u:y?0:-1;x="number"===typeof x.v?x.v:y?0:-1;if(!this.HasMesh())return!1;const J=this.GetSourceMesh(),B=J.GetMeshPointAt(p,r);if(null===B)return!1;let I=!1;"number"===typeof A&&B.GetZElevation()!==A&&(B.SetZElevation(A),I=!0);y&&(D+=p/(J.GetHSize()-1),G+=r/(J.GetVSize()-1));-1!==F||y?(y&&(F+=p/(J.GetHSize()-1)),F=e.clamp(F,0,1)):F=B.GetU();-1!==x||y?(y&&(x+=r/(J.GetVSize()-1)),
x=e.clamp(x,0,1)):x=B.GetV();if(B.GetX()===D&&B.GetY()===G&&B.GetU()===F&&B.GetV()===x)return I;B.SetX(D);B.SetY(G);B.SetU(F);B.SetV(x);this._DiscardTransformedCollisionPoly();return!0}HasTilemap(){return this._inst.HasTilemap()}ContainsPoint(p,r){return this.GetBoundingBox().containsPoint(p,r)&&this.GetBoundingQuad().containsPoint(p,r)?this.HasTilemap()?this._inst.GetSdkInstance().TestPointOverlapTile(p,r):this.HasOwnCollisionPoly()?this.GetTransformedCollisionPoly().containsPoint(p-this.GetX(),
r-this.GetY()):!0:!1}_IsCollisionCellChanged(){return 0!==(this._flags&16)}_UpdateCollisionCell(){if(this._IsCollisionCellChanged()&&this.IsCollisionEnabled()&&0===(this._flags&256)){var p=this.GetBoundingBox(),r=this._objectClass._GetCollisionCellGrid(),x=this._collisionCells;b.set(r.XToCell(p.getLeft()),r.YToCell(p.getTop()),r.XToCell(p.getRight()),r.YToCell(p.getBottom()));x.equals(b)||(p=this._inst,x===l?(r.Update(p,null,b),this._collisionCells=e.New(e.Rect,b)):(r.Update(p,x,b),x.copy(b)),this._flags&=
-17)}}_RemoveFromCollisionCells(){const p=this._collisionCells;p!==l&&(this._objectClass._GetCollisionCellGrid().Update(this._inst,p,null),this._collisionCells=l)}_UpdateRenderCell(){const p=this.GetLayer();if(p.UsesRenderCells()&&0===(this._flags&256)){var r=p.GetRenderGrid(),x=this.GetBoundingBox(),y=this._renderCells;b.set(r.XToCell(x.getLeft()),r.YToCell(x.getTop()),r.XToCell(x.getRight()),r.YToCell(x.getBottom()));y.equals(b)||(x=this._inst,y===g?(r.Update(x,null,b),this._renderCells=e.New(e.Rect,
b)):(r.Update(x,y,b),y.copy(b)),p.SetRenderListStale())}}_RemoveFromRenderCells(){const p=this._renderCells;p!==g&&(this.GetLayer().GetRenderGrid().Update(this._inst,p,null),this._renderCells=g)}GetRenderCellRange(){return this._renderCells}ZOrderMoveToTop(){const p=this._inst,r=this._layer,x=r._GetInstances();x.length&&x.at(-1)===p||(r._RemoveInstance(p,!1),r._AddInstance(p,!1),this._runtime.UpdateRender())}ZOrderMoveToBottom(){const p=this._inst,r=this._layer,x=r._GetInstances();x.length&&x[0]===
p||(r._RemoveInstance(p,!1),r._PrependInstance(p,!1),this._runtime.UpdateRender())}ZOrderMoveToLayer(p){const r=this._inst,x=this._layer;if(x.GetLayout()!==p.GetLayout())throw Error("layer from different layout");p!==x&&(x._RemoveInstance(r,!0),this._SetLayer(p),p._AddInstance(r,!0),this._runtime.UpdateRender())}ZOrderMoveAdjacentToInstance(p,r){const x=this._inst;let y=!1;const D=this._layer;if(p.GetUID()!==x.GetUID()){var G=p.GetWorldInfo();if(!G)throw Error("expected world instance");G=G.GetLayer();
D.GetIndex()!==G.GetIndex()&&(D._RemoveInstance(x,!0),this._SetLayer(G),G._AddInstance(x,!0),y=!0);p=G.MoveInstanceAdjacent(x,p,!!r);(y||p)&&this._runtime.UpdateRender()}}GetInstanceEffectList(){return this._instanceEffectList}_SetHasAnyActiveEffect(p){this._SetFlag(64,p)}HasAnyActiveEffect(){return 0!==(this._flags&64)}_SaveToJson(p){const r={x:this.GetX(),y:this.GetY(),w:this.GetWidth(),h:this.GetHeight(),l:this.GetLayer().GetSID(),zi:this.GetZIndex()};0!==this.GetZElevation()&&(r.ze=this.GetZElevation());
0!==this.GetAngle()&&(r.a=this.GetAngle());this.HasDefaultColor()||(r.c=this._color.toJSON());.5!==this.GetOriginX()&&(r.oX=this.GetOriginX());.5!==this.GetOriginY()&&(r.oY=this.GetOriginY());0!==this.GetBlendMode()&&(r.bm=this.GetBlendMode());this.IsVisible()||(r.v=this.IsVisible());this.IsCollisionEnabled()||(r.ce=this.IsCollisionEnabled());this.IsBboxChangeEventEnabled()&&(r.be=this.IsBboxChangeEventEnabled());this._instanceEffectList&&(r.fx=this._instanceEffectList._SaveToJson());const x=0!==
(this._flags&32);x&&(r.sfi=x);this._solidFilterTags&&(r.sft=[...this._solidFilterTags].join(" "));this._sceneGraphInfo&&"visual-state"!==p&&(r.sgi=this._sceneGraphInfo._SaveToJson());this.HasMesh()&&(r.mesh=this.GetSourceMesh().SaveToJson());return r}_OnBeforeLoad(p){"visual-state"!==p&&this._ResetAllSceneGraphState()}_LoadFromJson(p,r){w=!1;this.SetX(p.x);this.SetY(p.y);this.SetWidth(p.w);this.SetHeight(p.h);this._SetZIndex(p.zi);this.SetZElevation(p.hasOwnProperty("ze")?p.ze:0);this.SetAngle(p.hasOwnProperty("a")?
p.a:0);p.hasOwnProperty("c")?c.setFromJSON(p.c):p.hasOwnProperty("o")?(c.copyRgb(this._color),c.a=p.o):c.setRgba(1,1,1,1);this._SetColor(c);this.SetOriginX(p.hasOwnProperty("oX")?p.oX:.5);this.SetOriginY(p.hasOwnProperty("oY")?p.oY:.5);this.SetBlendMode(p.hasOwnProperty("bm")?p.bm:0);this.SetVisible(p.hasOwnProperty("v")?p.v:!0);this.SetCollisionEnabled(p.hasOwnProperty("ce")?p.ce:!0);this.SetBboxChangeEventEnabled(p.hasOwnProperty("be")?p.be:!1);this.SetSolidCollisionFilter(p.hasOwnProperty("sfi")?
p.sfi:!1,p.hasOwnProperty("sft")?p.sft:"");this._instanceEffectList&&p.hasOwnProperty("fx")&&this._instanceEffectList._LoadFromJson(p.fx);if(p.hasOwnProperty("sgi")&&"visual-state"!==r){this._CreateSceneGraphInfo(null);const x=this._sceneGraphInfo,y=p.sgi;x._LoadFromJson(y);const D=this.GetRuntime().Dispatcher(),G=()=>{D.removeEventListener("afterload",G);0===(this._flags&256)&&x._OnAfterLoad(y)};D.addEventListener("afterload",G)}p.hasOwnProperty("mesh")?(p=p.mesh,this.CreateMesh(p.cols,p.rows),this.GetSourceMesh().LoadFromJson(p)):
this.ReleaseMesh();this.SetBboxChanged();w=!0;this._UpdateRendererStateGroup()}}}
{"use strict";const e=self.C3;e.BehaviorType=class extends e.DefendedBase{constructor(b,a){super();const d=b.GetRuntime(),c=d.GetPluginManager(),f=d.GetObjectReference(a[1]);c.HasBehaviorByConstructorFunction(f)||c.CreateBehavior(a);this._runtime=d;this._objectClass=b;this._behavior=c.GetBehaviorByConstructorFunction(f);this._sdkType=null;this._instSdkCtor=f.Instance;this._sid=a[2];this._name=a[0];this._jsPropName=this._runtime.GetJsPropName(a[3]);this._sdkType=e.New(f.Type,this);this.OnCreate()}static Create(b,
a){return e.New(e.BehaviorType,b,a)}Release(){this._behavior=this._runtime=null;this._sdkType.Release();this._instSdkCtor=this._sdkType=null}GetSdkType(){return this._sdkType}OnCreate(){this._sdkType.OnCreate()}GetRuntime(){return this._runtime}GetObjectClass(){return this._objectClass}GetBehavior(){return this._behavior}GetInstanceSdkCtor(){return this._instSdkCtor}GetName(){return this._name}GetSID(){return this._sid}GetJsPropName(){return this._jsPropName}}}
{"use strict";const e=self.C3,b=self.IBehaviorInstance;e.BehaviorInstance=class extends e.DefendedBase{constructor(a){super();this._runtime=a.runtime;this._behaviorType=a.behaviorType;this._behavior=this._behaviorType.GetBehavior();this._inst=a.instance;this._index=a.index;this._iScriptInterface=this._sdkInst=null;this._behavior._AddInstance(this._inst)}Release(){this._iScriptInterface&&(this._iScriptInterface._Release(),this._iScriptInterface=null);this._behavior._RemoveInstance(this._inst);this._sdkInst.Release();
this._inst=this._behavior=this._behaviorType=this._runtime=this._iScriptInterface=this._sdkInst=null}_CreateSdkInstance(a){if(this._sdkInst)throw Error("already got sdk instance");this._sdkInst=e.New(this._behaviorType.GetInstanceSdkCtor(),this,a);this._InitScriptInterface()}GetSdkInstance(){return this._sdkInst}GetObjectInstance(){return this._inst}GetRuntime(){return this._runtime}GetBehaviorType(){return this._behaviorType}GetBehavior(){return this._behavior}_GetIndex(){return this._index}PostCreate(){this._sdkInst.PostCreate()}OnSpriteFrameChanged(a,
d){this._sdkInst.OnSpriteFrameChanged(a,d)}_GetDebuggerProperties(){return this._sdkInst.GetDebuggerProperties()}SaveToJson(){return this._sdkInst.SaveToJson()}LoadFromJson(a){return this._sdkInst.LoadFromJson(a)}static SortByTickSequence(a,d){var c=a.GetObjectInstance(),f=d.GetObjectInstance();const h=c.GetObjectClass().GetIndex(),g=f.GetObjectClass().GetIndex();if(h!==g)return h-g;c=c.GetPUID();f=f.GetPUID();return c!==f?c-f:a.GetBehaviorInstance()._GetIndex()-d.GetBehaviorInstance()._GetIndex()}_InitScriptInterface(){const a=
this._sdkInst.GetScriptInterfaceClass(),d=a||b;b._Init(this);this._iScriptInterface=new d;b._Init(null);if(a&&!(this._iScriptInterface instanceof b))throw new TypeError(`script interface class '${a.name}' does not extend the right base class '${b.name}'`);}GetScriptInterface(){return this._iScriptInterface}}}
{"use strict";const e=self.C3;e.EffectList=class extends e.DefendedBase{constructor(b,a){super();this._owner=b;this._allEffectTypes=[];this._activeEffectTypes=[];this._effectTypesByName=new Map;this._effectParams=[];this._preservesOpaqueness=!0;for(const d of a)b=e.New(e.EffectType,this,d,this._allEffectTypes.length),this._allEffectTypes.push(b),this._effectTypesByName.set(b.GetName().toLowerCase(),b),3<=d.length&&this._effectParams.push(this._LoadSingleEffectParameters(d[2]));this.GetRuntime()._AddEffectList(this)}Release(){e.clearArray(this._allEffectTypes);
e.clearArray(this._activeEffectTypes);this._effectTypesByName.clear();e.clearArray(this._effectParams);this._owner=null}PrependEffectTypes(b){if(b.length){this._allEffectTypes=b.concat(this._allEffectTypes);for(const a of b)this._effectTypesByName.set(a.GetName().toLowerCase(),a);for(let a=0,d=this._allEffectTypes.length;a<d;++a)this._allEffectTypes[a]._SetIndex(a)}}_LoadSingleEffectParameters(b){b=b.slice(0);for(let a=0,d=b.length;a<d;++a){const c=b[a];if(Array.isArray(c)){const f=e.New(e.Color);
f.setFromJSON(c);b[a]=f}}return b}GetOwner(){return this._owner}GetRuntime(){return this._owner.GetRuntime()}UpdateActiveEffects(){e.clearArray(this._activeEffectTypes);let b=!0;for(const a of this._allEffectTypes)a.IsActive()&&(this._activeEffectTypes.push(a),a.GetShaderProgram().PreservesOpaqueness()||(b=!1));this._preservesOpaqueness=b}GetAllEffectTypes(){return this._allEffectTypes}HasAnyEffectType(){return 0<this._allEffectTypes.length}GetEffectTypeByName(b){return this._effectTypesByName.get(b.toLowerCase())||
null}GetEffectTypeByIndex(b){b=Math.floor(+b);if(0>b||b>=this._allEffectTypes.length)throw new RangeError("invalid effect type index");return this._allEffectTypes[b]}IsEffectIndexActive(b){return this.GetEffectTypeByIndex(b).IsActive()}SetEffectIndexActive(b,a){this.GetEffectTypeByIndex(b).SetActive(a)}GetActiveEffectTypes(){return this._activeEffectTypes}HasAnyActiveEffect(){return 0<this._activeEffectTypes.length}PreservesOpaqueness(){return this._preservesOpaqueness}GetEffectParametersForIndex(b){return this._effectParams[b]}static SaveFxParamToJson(b){return b&&
b instanceof e.Color?{t:"color",v:b.toJSON()}:b}static LoadFxParamFromJson(b){if("object"===typeof b){if("color"===b.t){const a=e.New(e.Color);a.setFromJSON(b.v);return a}throw Error("invalid effect parameter type");}return b}static SaveFxParamsToJson(b){return b.map(e.EffectList.SaveFxParamToJson)}static LoadFxParamsFromJson(b){return b.map(e.EffectList.LoadFxParamFromJson)}SaveToJson(){return this._allEffectTypes.map(b=>({name:b.GetName(),active:b.IsActive(),params:e.EffectList.SaveFxParamsToJson(this._effectParams[b.GetIndex()])}))}LoadFromJson(b){for(const a of b)if(b=
this.GetEffectTypeByName(a.name))b.SetActive(a.active),this._effectParams[b.GetIndex()]=e.EffectList.LoadFxParamsFromJson(a.params);this.UpdateActiveEffects()}}}
{"use strict";const e=self.C3;e.EffectType=class extends e.DefendedBase{constructor(b,a,d){super();this._effectList=b;this._id=a[0];this._name=a[1];this._index=d;this._shaderProgram=null;this._isActive=!0}Release(){this._shaderProgram=this._effectList=null}Clone(b){b=e.New(e.EffectType,b,[this._id,this._name],-1);b._shaderProgram=this._shaderProgram;b._isActive=this._isActive;return b}_InitRenderer(b){b=b.GetShaderProgramByName(this._id);if(!b)throw Error("failed to find shader program '"+this._id+
"'");this._shaderProgram=b}GetEffectList(){return this._effectList}GetName(){return this._name}_SetIndex(b){this._index=b}GetIndex(){return this._index}GetOwner(){return this._effectList.GetOwner()}GetRuntime(){return this._effectList.GetRuntime()}SetActive(b){this._isActive=!!b}IsActive(){return this._isActive}GetShaderProgram(){return this._shaderProgram}GetDefaultParameterValues(){const b=[];for(let a=0,d=this._shaderProgram.GetParameterCount();a<d;++a){const c=this._shaderProgram.GetParameterType(a);
if("float"===c||"percent"===c)b.push(0);else if("color"===c)b.push(e.New(e.Color,1,1,1,1));else throw new TypeError("unknown effect parameter type");}return b}}}
{"use strict";const e=self.C3;e.InstanceEffectList=class extends e.DefendedBase{constructor(b,a){super();this._inst=b;this._wi=a;this._effectList=b.GetObjectClass().GetEffectList();this._wasDefaultColor=this._needsRebuildSteps=!0;this._wasTexRotated=this._wasRotatedOrNegativeSize=this._was3D=!1;this._effectChain=e.New(e.Gfx.EffectChain,b.GetRuntime().GetCanvasManager().GetEffectChainManager(),{drawContent:(d,c)=>{c=c.GetContentObject();const f=c.GetWorldInfo();d.SetColor(f.GetPremultipliedColor());
d.SetCurrentZ(f.GetTotalZElevation());c.Draw(d);d.SetCurrentZ(0)},getSourceTextureInfo:d=>{const c=d.GetCurrentTexRect(),[f,h]=d.GetCurrentSurfaceSize();return{srcTexRect:c,srcWidth:f,srcHeight:h}},getShaderParameters:d=>this.GetEffectParametersForIndex(d)});this._activeEffectFlags=[];this._activeEffectTypes=[];this._preservesOpaqueness=!0;this._effectParams=[];for(const d of this._effectList.GetAllEffectTypes())this._activeEffectFlags.push(!0);this.UpdateActiveEffects()}Release(){this._effectChain.Release();
this._effectChain=null;e.clearArray(this._activeEffectFlags);e.clearArray(this._activeEffectTypes);e.clearArray(this._effectParams);this._effectList=this._inst=null}_LoadEffectParameters(b){for(const a of b)this._effectParams.push(this._LoadSingleEffectParameters(a))}_LoadSingleEffectParameters(b){b=b.slice(0);for(let a=0,d=b.length;a<d;++a){const c=b[a];if(Array.isArray(c)){const f=e.New(e.Color);f.setFromJSON(c);b[a]=f}}return b}LoadDefaultEffectParameters(){for(const b of this._effectList.GetAllEffectTypes())this._effectParams.push(b.GetDefaultParameterValues())}GetOwner(){return this._owner}GetEffectList(){return this._effectList}GetEffectChain(){this._MaybeRebuildEffectChainSteps();
return this._effectChain}GetRuntime(){return this._inst.GetRuntime()}UpdateActiveEffects(){e.clearArray(this._activeEffectTypes);const b=this._wi,a=this._effectList.GetAllEffectTypes(),d=this._activeEffectTypes,c=this._activeEffectFlags;let f=!0;for(let h=0,g=a.length;h<g;++h)if(c[h]){const l=a[h];d.push(l);l.GetShaderProgram().PreservesOpaqueness()||(f=!1)}this._preservesOpaqueness=f;b._SetHasAnyActiveEffect(!!d.length);this._needsRebuildSteps=!0}_MaybeRebuildEffectChainSteps(){const b=this._inst;
var a=this._wi;const d=a.HasDefaultColor(),c=0<a.GetDepth();a=0!==a.GetAngle()||0>a.GetWidth()||0>a.GetHeight();const f=b.IsCurrentTexRotated();if(this._needsRebuildSteps||d!==this._wasDefaultColor||c!==this._was3D||a!==this._wasRotatedOrNegativeSize||f!==this._wasTexRotated)this._effectChain.BuildSteps(this._activeEffectTypes.map(h=>h.GetShaderProgram()),{indexMap:this._activeEffectTypes.map(h=>h.GetIndex()),forcePreDraw:!d||b.MustPreDraw(),is3D:c,isSourceTextureRotated:f,isRotatedOrNegativeSizeInstance:a}),
this._needsRebuildSteps=!1,this._wasDefaultColor=d,this._was3D=c,this._wasRotatedOrNegativeSize=a,this._wasTexRotated=f}GetActiveEffectTypes(){return this._activeEffectTypes}GetEffectParametersForIndex(b){return this._effectParams[b]}PreservesOpaqueness(){return this._preservesOpaqueness}HasAnyActiveBackgroundBlendingEffect(){return this._activeEffectTypes.some(b=>b.GetShaderProgram().BlendsBackground())}IsEffectIndexActive(b){return this._activeEffectFlags[b]}SetEffectIndexActive(b,a){this._activeEffectFlags[b]=
!!a}GetAllEffectTypes(){return this._effectList.GetAllEffectTypes()}_SaveToJson(){return this._effectList.GetAllEffectTypes().map(b=>({name:b.GetName(),active:this._activeEffectFlags[b.GetIndex()],params:e.EffectList.SaveFxParamsToJson(this._effectParams[b.GetIndex()])}))}_LoadFromJson(b){for(const a of b)if(b=this._effectList.GetEffectTypeByName(a.name))this._activeEffectFlags[b.GetIndex()]=a.active,this._effectParams[b.GetIndex()]=e.EffectList.LoadFxParamsFromJson(a.params);this.UpdateActiveEffects()}}}
{"use strict";const e=self.C3,b=[],a=[],d=[],c=e.New(e.CollisionPoly),f=e.New(e.CollisionPoly),h=e.New(e.Quad),g=e.New(e.Rect),l=e.New(e.Rect);let m=null,u=null,w=null;e.CollisionEngine=class extends e.DefendedBase{constructor(q){super();this._runtime=q;this._registeredCollisions=[];this._polyCheckSec=this._polyCheckCount=this._collisionCheckSec=this._collisionCheckCount=0}Release(){this._runtime=null}_Update1sStats(){this._collisionCheckSec=this._collisionCheckCount;this._collisionCheckCount=0;this._polyCheckSec=
this._polyCheckCount;this._polyCheckCount=0}Get1secCollisionChecks(){return this._collisionCheckSec}Get1secPolyChecks(){return this._polyCheckSec}RegisterCollision(q,t){const p=q.GetWorldInfo(),r=t.GetWorldInfo();p&&r&&p.IsCollisionEnabled()&&r.IsCollisionEnabled()&&this._registeredCollisions.push([q,t])}AddRegisteredCollisionCandidates(q,t,p){for(const [r,x]of this._registeredCollisions){let y;if(q===r)y=x;else if(q===x)y=r;else continue;y.BelongsToObjectClass(t)&&(p.includes(y)||p.push(y))}}CheckRegisteredCollision(q,
t){if(!this._registeredCollisions.length)return!1;for(const [p,r]of this._registeredCollisions)if(q===p&&t===r||q===r&&t===p)return!0;return!1}ClearRegisteredCollisions(){e.clearArray(this._registeredCollisions)}TestOverlap(q,t){if(!q||!t||q===t)return!1;q=q.GetWorldInfo();t=t.GetWorldInfo();if(!q.IsCollisionEnabled()||!t.IsCollisionEnabled())return!1;this._collisionCheckCount++;const p=q.GetLayer(),r=t.GetLayer();return p.IsTransformCompatibleWith(r)?this._TestOverlap_SameLayers(q,t):this._TestOverlap_DifferentLayers(q,
t)}_TestOverlap_SameLayers(q,t){if(!q.GetBoundingBox().intersectsRect(t.GetBoundingBox()))return!1;this._polyCheckCount++;if(!q.GetBoundingQuad().intersectsQuad(t.GetBoundingQuad())||q.HasTilemap()&&t.HasTilemap())return!1;if(q.HasTilemap())return this.TestTilemapOverlap(q,t);if(t.HasTilemap())return this.TestTilemapOverlap(t,q);if(!q.HasOwnCollisionPoly()&&!t.HasOwnCollisionPoly())return!0;const p=q.GetTransformedCollisionPoly(),r=t.GetTransformedCollisionPoly();return p.intersectsPoly(r,t.GetX()-
q.GetX(),t.GetY()-q.GetY())}_TestOverlap_DifferentLayers(q,t){var p=q.HasTilemap(),r=t.HasTilemap();if(p&&!r)return this.TestTilemapOverlapDifferentLayers(q,t);if(r&&!p)return this.TestTilemapOverlapDifferentLayers(t,q);if(r||p)return!1;r=q.GetLayer();p=t.GetLayer();c.copy(q.GetTransformedCollisionPoly());f.copy(t.GetTransformedCollisionPoly());var x=c.pointsArr();for(let y=0,D=x.length;y<D;y+=2){const G=y+1,A=x[G],[F,J]=r.LayerToCanvasCss(x[y]+q.GetX(),A+q.GetY());x[y]=F;x[G]=J}q=f.pointsArr();for(let y=
0,D=q.length;y<D;y+=2){r=y+1;x=q[r];const [G,A]=p.LayerToCanvasCss(q[y]+t.GetX(),x+t.GetY());q[y]=G;q[r]=A}c.setBboxChanged();f.setBboxChanged();this._polyCheckCount++;return c.intersectsPoly(f,0,0)}TestTilemapOverlapDifferentLayers(q,t){var p=q.GetLayer(),r=t.GetLayer();m||(m=e.New(e.CollisionPoly));u||(u=e.New(e.Rect));w||(w=e.New(e.Quad));var x=t.GetX(),y=t.GetY();const [D,G]=r.LayerToCanvasCss(x,y),[A,F]=p.CanvasCssToLayer(D,G);p=A-x;y=F-y;u.copy(t.GetBoundingBox());u.offset(p,y);if(!q.GetBoundingBox().intersectsRect(u))return!1;
w.copy(t.GetBoundingQuad());w.offset(p,y);this._polyCheckCount++;if(!q.GetBoundingQuad().intersectsQuad(w))return!1;m.copy(t.GetTransformedCollisionPoly());r=m.pointsArr();for(let J=0,B=r.length;J<B;J+=2)x=J+1,r[J]+=p,r[x]+=y;m.setBboxChanged();return this.TestTilemapOverlap(q,t,A,F,m,u,w)}TestTilemapOverlap(q,t,p,r,x,y,D){y=void 0!==y?y:t.GetBoundingBox();const G=q.GetX(),A=q.GetY();var F=q.GetInstance().GetSdkInstance();p=void 0!==p?p:t.GetX();r=void 0!==r?r:t.GetY();q=t.HasOwnCollisionPoly();D=
void 0!==D?D:t.GetBoundingQuad();F.GetCollisionRectCandidates(y,a);for(let I=0,L=a.length;I<L;++I){var J=a[I];F=J.GetRect();this._collisionCheckCount++;if(y.intersectsRectOffset(F,G,A)&&(h.setFromRect(F),h.offset(G,A),h.intersectsQuad(D)))if(q){var B=void 0!==x?x:t.GetTransformedCollisionPoly();if(J=J.GetPoly()){if(this._polyCheckCount++,J.intersectsPoly(B,p-(G+F.getLeft()),r-(A+F.getTop())))return e.clearArray(a),!0}else if(c.setFromQuad(h,0,0),c.intersectsPoly(B,p,r))return e.clearArray(a),!0}else if(B=
J.GetPoly()){if(c.setFromQuad(D,0,0),B.intersectsPoly(c,-(G+F.getLeft()),-(A+F.getTop())))return e.clearArray(a),!0}else return e.clearArray(a),!0}e.clearArray(a);return!1}TestAndSelectCanvasPointOverlap(q,t,p,r){const x=q.GetCurrentSol();var y=this._runtime.GetCurrentEvent();if(!y)throw Error("cannot call outside event");y=y.IsOrBlock();if(x.IsSelectAll()){r||(x._SetSelectAll(!1),e.clearArray(x._GetOwnInstances()));for(var D of q.GetInstances()){var G=D.GetWorldInfo(),A=G.GetLayer();const [F,J]=
A.CanvasCssToLayer(t,p,G.GetTotalZElevation());if(A.IsSelfAndParentsInteractive()&&G.ContainsPoint(F,J)){if(r)return!1;x._PushInstance(D)}else y&&x._PushElseInstance(D)}}else{G=!1;y?this._runtime.IsCurrentConditionFirst()&&!x._GetOwnElseInstances().length&&x._GetOwnInstances().length?D=x._GetOwnInstances():(D=x._GetOwnElseInstances(),G=!0):D=x._GetOwnInstances();A=0;for(let F=0,J=D.length;F<J;++F){const B=D[F],I=B.GetWorldInfo(),L=I.GetLayer(),[Q,S]=L.CanvasCssToLayer(t,p,I.GetTotalZElevation());
if(L.IsSelfAndParentsInteractive()&&I.ContainsPoint(Q,S)){if(r)return!1;G?x._PushInstance(B):D[A++]=B}else G?D[A++]=B:y&&x._PushElseInstance(B)}r||(D.length=A)}q.ApplySolToContainer();return r?!0:x.HasAnyInstances()}GetCollisionCandidates(q,t,p,r){q=q?1!==q.GetParallaxX()||1!==q.GetParallaxY():!1;if(t.IsFamily())for(const x of t.GetFamilyMembers())q||x.IsAnyInstanceParallaxed()?e.appendArray(r,x.GetInstances()):(x._UpdateAllCollisionCells(),x._GetCollisionCellGrid().QueryRange(p,r));else q||t.IsAnyInstanceParallaxed()?
e.appendArray(r,t.GetInstances()):(t._UpdateAllCollisionCells(),t._GetCollisionCellGrid().QueryRange(p,r))}GetObjectClassesCollisionCandidates(q,t,p,r){for(const x of t)this.GetCollisionCandidates(q,x,p,r)}GetSolidCollisionCandidates(q,t,p){const r=this._runtime.GetSolidBehavior();r&&this.GetObjectClassesCollisionCandidates(q,r.GetObjectClasses(),t,p)}GetJumpthruCollisionCandidates(q,t,p){const r=this._runtime.GetJumpthruBehavior();r&&this.GetObjectClassesCollisionCandidates(q,r.GetObjectClasses(),
t,p)}IsSolidCollisionAllowed(q,t){return q._IsSolidEnabled()&&(!t||t.GetWorldInfo().IsSolidCollisionAllowed(q.GetSavedDataMap().get("solidTags")))}TestOverlapSolid(q){const t=q.GetWorldInfo();this.GetSolidCollisionCandidates(t.GetLayer(),t.GetBoundingBox(),b);for(const p of b)if(this.IsSolidCollisionAllowed(p,q)&&this.TestOverlap(q,p))return e.clearArray(b),p;e.clearArray(b);return null}TestRectOverlapSolid(q,t){this.GetSolidCollisionCandidates(null,q,b);for(const p of b)if(this.IsSolidCollisionAllowed(p,
t)&&this.TestRectOverlap(q,p))return e.clearArray(b),p;e.clearArray(b);return null}TestOverlapJumpthru(q,t){let p=null;t&&(p=d,e.clearArray(p));const r=q.GetWorldInfo();this.GetJumpthruCollisionCandidates(r.GetLayer(),r.GetBoundingBox(),b);for(const x of b)if(x._IsJumpthruEnabled()&&this.TestOverlap(q,x))if(t)p.push(x);else return e.clearArray(b),x;e.clearArray(b);return p}PushOut(q,t,p,r,x){r=r||50;const y=q.GetWorldInfo(),D=y.GetX(),G=y.GetY();for(let A=0;A<r;++A)if(y.SetXY(D+t*A,G+p*A),y.SetBboxChanged(),
!this.TestOverlap(q,x))return!0;y.SetXY(D,G);y.SetBboxChanged();return!1}PushOutSolid(q,t,p,r,x,y){r=r||50;const D=q.GetWorldInfo(),G=D.GetX(),A=D.GetY();let F=null,J=null;for(let B=0;B<r;++B)if(D.SetXY(G+t*B,A+p*B),D.SetBboxChanged(),!this.TestOverlap(q,F))if(F=this.TestOverlapSolid(q))J=F;else if(x&&(F=y?this.TestOverlap(q,y)?y:null:this.TestOverlapJumpthru(q))&&(J=F),!F)return J&&this.PushInFractional(q,t,p,J,16,!0),!0;D.SetXY(G,A);D.SetBboxChanged();return!1}PushOutSolidAxis(q,t,p,r){r=r||50;
const x=q.GetWorldInfo(),y=x.GetX(),D=x.GetY();let G=null,A=null;for(let F=0;F<r;++F)for(let J=0;2>J;++J){const B=2*J-1;x.SetXY(y+t*F*B,D+p*F*B);x.SetBboxChanged();if(!this.TestOverlap(q,G))if(G=this.TestOverlapSolid(q))A=G;else return A&&this.PushInFractional(q,t*B,p*B,A,16,!0),!0}x.SetXY(y,D);x.SetBboxChanged();return!1}PushInFractional(q,t,p,r,x,y){let D=2,G=!1;var A=!1;const F=q.GetWorldInfo();let J=F.GetX(),B=F.GetY();for(;D<=x;)A=1/D,D*=2,F.OffsetXY(t*A*(G?1:-1),p*A*(G?1:-1)),F.SetBboxChanged(),
this.TestOverlap(q,r)||y&&this.TestOverlapSolid(q)?A=G=!0:(A=G=!1,J=F.GetX(),B=F.GetY());A&&(F.SetXY(J,B),F.SetBboxChanged())}PushOutSolidNearest(q,t=100){let p=0;const r=q.GetWorldInfo(),x=r.GetX(),y=r.GetY();let D=0,G=this.TestOverlapSolid(q);if(!G)return!0;for(;p<=t;){let A=0,F=0;switch(D){case 0:A=0;F=-1;p++;break;case 1:A=1;F=-1;break;case 2:A=1;F=0;break;case 3:F=A=1;break;case 4:A=0;F=1;break;case 5:A=-1;F=1;break;case 6:A=-1;F=0;break;case 7:F=A=-1}D=(D+1)%8;r.SetXY(Math.floor(x+A*p),Math.floor(y+
F*p));r.SetBboxChanged();if(!this.TestOverlap(q,G)&&(G=this.TestOverlapSolid(q),!G))return!0}r.SetXY(x,y);r.SetBboxChanged();return!1}CalculateBounceAngle(q,t,p,r){const x=q.GetWorldInfo(),y=x.GetX(),D=x.GetY(),G=Math.max(10,e.distanceTo(t,p,y,D));var A=e.angleTo(t,p,y,D),F=r||this.TestOverlapSolid(q);if(!F)return e.clampAngle(A+Math.PI);let J=F;var B=0,I=0;const L=e.toRadians(5);let Q;for(Q=1;36>Q;++Q){const S=A-Q*L;x.SetXY(t+Math.cos(S)*G,p+Math.sin(S)*G);x.SetBboxChanged();if(!this.TestOverlap(q,
J)&&(J=r?null:this.TestOverlapSolid(q),!J)){B=S;break}}36===Q&&(B=e.clampAngle(A+Math.PI));J=F;for(Q=1;36>Q;++Q)if(F=A+Q*L,x.SetXY(t+Math.cos(F)*G,p+Math.sin(F)*G),x.SetBboxChanged(),!this.TestOverlap(q,J)&&(J=r?null:this.TestOverlapSolid(q),!J)){I=F;break}36===Q&&(I=e.clampAngle(A+Math.PI));x.SetXY(y,D);x.SetBboxChanged();if(I===B)return I;q=e.angleDiff(I,B)/2;q=e.angleClockwise(I,B)?e.clampAngle(B+q+Math.PI):e.clampAngle(I+q);B=Math.cos(A);A=Math.sin(A);I=Math.cos(q);q=Math.sin(q);t=B*I+A*q;return e.angleTo(0,
0,B-2*t*I,A-2*t*q)}TestSegmentOverlap(q,t,p,r,x){if(!x)return!1;const y=x.GetWorldInfo();if(!y.IsCollisionEnabled())return!1;this._collisionCheckCount++;g.set(Math.min(q,p),Math.min(t,r),Math.max(q,p),Math.max(t,r));if(!y.GetBoundingBox().intersectsRect(g))return!1;if(x.HasTilemap())return this._TestSegmentOverlapTilemap(q,t,p,r,x,y);this._polyCheckCount++;return y.GetBoundingQuad().intersectsSegment(q,t,p,r)?y.HasOwnCollisionPoly()?y.GetTransformedCollisionPoly().intersectsSegment(y.GetX(),y.GetY(),
q,t,p,r):!0:!1}_TestSegmentOverlapTilemap(q,t,p,r,x,y){const D=y.GetX();y=y.GetY();x=x.GetSdkInstance();l.set(q,t,p,r);l.normalize();x.GetCollisionRectCandidates(l,a);for(let A=0,F=a.length;A<F;++A){var G=a[A];x=G.GetRect();this._collisionCheckCount++;if(g.intersectsRectOffset(x,D,y)&&(h.setFromRect(x),h.offset(D,y),h.intersectsSegment(q,t,p,r)))if(G=G.GetPoly()){if(this._polyCheckCount++,G.intersectsSegment(D+x.getLeft(),y+x.getTop(),q,t,p,r))return e.clearArray(a),!0}else return e.clearArray(a),
!0}e.clearArray(a);return!1}TestRectOverlap(q,t){if(!t)return!1;const p=t.GetWorldInfo();if(!p.IsCollisionEnabled())return!1;this._collisionCheckCount++;if(!p.GetBoundingBox().intersectsRect(q))return!1;if(t.HasTilemap())return this._TestRectOverlapTilemap(q,t,p);this._polyCheckCount++;h.setFromRect(q);if(!p.GetBoundingQuad().intersectsQuad(h))return!1;if(!p.HasOwnCollisionPoly())return!0;c.setFromRect(q,p.GetX(),p.GetY());q=p.GetTransformedCollisionPoly();return c.intersectsPoly(q,0,0)}_TestRectOverlapTilemap(q,
t,p){const r=p.GetX();p=p.GetY();t.GetSdkInstance().GetCollisionRectCandidates(q,a);for(let y=0,D=a.length;y<D;++y){var x=a[y];t=x.GetRect();this._collisionCheckCount++;if(q.intersectsRectOffset(t,r,p))if(x=x.GetPoly()){if(this._polyCheckCount++,c.setFromRect(q,0,0),x.intersectsPoly(c,-(r+t.getLeft()),-(p+t.getTop())))return e.clearArray(a),!0}else return e.clearArray(a),!0}e.clearArray(a);return!1}TestRayIntersectsInstance(q,t){if(q){var p=q.GetWorldInfo();p.IsCollisionEnabled()&&(this._collisionCheckCount++,
p.GetBoundingBox().intersectsRect(t.rect)&&(q.HasTilemap()?this._TestRayIntersectsTilemap(q,p,t):(this._polyCheckCount++,p.HasOwnCollisionPoly()?t.TestInstancePoly(q,p.GetX(),p.GetY(),p.GetTransformedCollisionPoly()):t.TestInstanceQuad(q,p.GetBoundingQuad()))))}}_TestRayIntersectsTilemap(q,t,p){const r=t.GetX(),x=t.GetY();q.GetSdkInstance().GetCollisionRectCandidates(p.rect,a);for(let D=0,G=a.length;D<G;D++){var y=a[D];const A=y.GetRect();this._collisionCheckCount++;p.rect.intersectsRectOffset(A,
r,x)&&(y=y.GetPoly(),this._polyCheckCount++,y?p.TestInstancePoly(q,r+A.getLeft(),x+A.getTop(),y):p.TestInstanceRect(q,t.GetX(),t.GetY(),A))}e.clearArray(a)}}}
{"use strict";const e=self.C3;e.SparseGrid=class extends e.DefendedBase{constructor(b,a){super();this._cellWidth=b;this._cellHeight=a;this._cells=e.New(e.PairMap)}Release(){this._cells.Release();this._cells=null}GetCell(b,a,d){let c=this._cells.Get(b,a);return c?c:d?(c=e.New(e.GridCell,this,b,a),this._cells.Set(b,a,c),c):null}XToCell(b){b=Math.floor(b/this._cellWidth);return isFinite(b)?b:0}YToCell(b){b=Math.floor(b/this._cellHeight);return isFinite(b)?b:0}Update(b,a,d){if(a)for(let c=a.getLeft(),
f=a.getRight();c<=f;++c)for(let h=a.getTop(),g=a.getBottom();h<=g;++h){if(d&&d.containsPoint(c,h))continue;const l=this.GetCell(c,h,!1);l&&(l.Remove(b),l.IsEmpty()&&this._cells.Delete(c,h))}if(d)for(let c=d.getLeft(),f=d.getRight();c<=f;++c)for(let h=d.getTop(),g=d.getBottom();h<=g;++h)a&&a.containsPoint(c,h)||this.GetCell(c,h,!0).Insert(b)}QueryRange(b,a){let d=this.XToCell(b.getLeft());const c=this.YToCell(b.getTop()),f=this.XToCell(b.getRight());b=this.YToCell(b.getBottom());if(isFinite(f)&&isFinite(b))for(;d<=
f;++d)for(let h=c;h<=b;++h){const g=this.GetCell(d,h,!1);g&&g.Dump(a)}}}}{"use strict";const e=self.C3;e.GridCell=class extends e.DefendedBase{constructor(b,a,d){super();this._grid=b;this._x=a;this._y=d;this._instances=e.New(e.ArraySet)}Release(){this._instances.Release();this._grid=this._instances=null}IsEmpty(){return this._instances.IsEmpty()}Insert(b){this._instances.Add(b)}Remove(b){this._instances.Delete(b)}Dump(b){e.appendArray(b,this._instances.GetArray())}}}
{"use strict";const e=self.C3;e.Ray=class{constructor(){this.dy=this.dx=this.y2=this.x2=this.y1=this.x1=0;this.rect=new e.Rect;this.hitFraction=2;this.hitUid=null;this.distance=this.hitY=this.hitX=this.hitNormalDy=this.hitNormalDx=this.hitNormal=0;this.normalX=1;this.normalY=0;this.reflectionX=1;this.reflectionY=0}DidCollide(){return 1.000001>this.hitFraction}Set(b,a,d,c){this.x1=b;this.y1=a;this.x2=d;this.y2=c;this.dx=d-b;this.dy=c-a;this.rect.set(b,a,d,c);this.rect.normalize();this.hitFraction=
2;this.hitUid=null;this.distance=this.hitY=this.hitX=this.hitNormalDy=this.hitNormalDx=this.hitNormal=0;this.normalX=1;this.normalY=0;this.reflectionX=1;this.reflectionY=0;return this}Complete(){if(!1!==this.DidCollide()){var b=this.dx*this.hitFraction,a=this.dy*this.hitFraction,d=Math.sqrt(b*b+a*a);b/=d;a/=d;this.distance=d-1E-6;this.hitX=this.x1+b*this.distance;this.hitY=this.y1+a*this.distance;this.hitNormal=Math.atan2(this.hitNormalDy,this.hitNormalDx)+Math.PI/2;this.normalX=Math.cos(this.hitNormal);
this.normalY=Math.sin(this.hitNormal);d=b*this.normalX+a*this.normalY;this.reflectionX=b-2*this.normalX*d;this.reflectionY=a-2*this.normalY*d;0<d&&(this.hitNormal=e.clampAngle(this.hitNormal+Math.PI),this.normalX=-this.normalX,this.normalY=-this.normalY)}}TestInstanceSegment(b,a,d,c,f){const h=e.rayIntersect(this.x1,this.y1,this.x2,this.y2,a,d,c,f);0<=h&&h<this.hitFraction&&(this.hitFraction=h,this.hitUid=b.GetUID(),this.hitNormalDx=a-c,this.hitNormalDy=d-f)}TestInstanceRect(b,a,d,c){const f=a+c.getLeft();
a+=c.getRight();const h=d+c.getTop();d+=c.getBottom();this.TestInstanceSegment(b,f,h,a,h);this.TestInstanceSegment(b,a,h,a,d);this.TestInstanceSegment(b,a,d,f,d);this.TestInstanceSegment(b,f,d,f,h)}TestInstanceQuad(b,a){const d=a.getTlx(),c=a.getTly(),f=a.getTrx(),h=a.getTry(),g=a.getBrx(),l=a.getBry(),m=a.getBlx();a=a.getBly();this.TestInstanceSegment(b,d,c,f,h);this.TestInstanceSegment(b,f,h,g,l);this.TestInstanceSegment(b,g,l,m,a);this.TestInstanceSegment(b,m,a,d,c)}TestInstancePoly(b,a,d,c){c=
c.pointsArr();for(let f=0,h=c.length;f<h;f+=2){const g=(f+2)%h;this.TestInstanceSegment(b,c[f]+a,c[f+1]+d,c[g]+a,c[g+1]+d)}}}}
{"use strict";const e=self.C3,b=new Set("off crop scale-inner scale-outer letterbox-scale letterbox-integer-scale".split(" ")),a=new Set(["high","low"]),d=self.glMatrix.mat4,c=d.create(),f=e.New(e.Quad),h=e.New(e.Rect);e.CanvasManager=class extends e.DefendedBase{constructor(g){super();this._runtime=g;this._canvas=null;this._isWebGPUEnabled=!1;this._webgpuRenderer=this._webglRenderer=null;this._gpuPreference="high-performance";this._canvasCssOffsetY=this._canvasCssOffsetX=this._canvasDeviceHeight=
this._canvasDeviceWidth=this._canvasCssHeight=this._canvasCssWidth=this._windowInnerHeight=this._windowInnerWidth=0;this._zAxisScale="normalized";this._fieldOfView=0;this._enableMipmaps=!0;this._drawHeight=this._drawWidth=this._textureAnisotropy=0;this._documentFullscreenMode=this._fullscreenMode="letterbox-scale";this._deviceTransformOffY=this._deviceTransformOffX=0;this._defaultProjectionMatrix=d.create();this._fullscreenScalingQuality=this._wantFullscreenScalingQuality="high";this._isDocumentFullscreen=
!1;this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets=new Set;this._shaderData=self.C3_Shaders;this._effectChainManager=e.New(e.Gfx.EffectChainManager,{getDrawSize:()=>[this.GetDrawWidth(),this.GetDrawHeight()],getRenderTarget:()=>this.GetEffectCompositorRenderTarget(),releaseRenderTarget:l=>this.ReleaseEffectCompositorRenderTarget(l),getTime:()=>this.GetRuntime().GetGameTime(),redraw:()=>this.GetRuntime().UpdateRender()});this._gpuTimeEndFrame=this._gpuTimeStartFrame=0;this._gpuLastUtilisation=
NaN;this._gpuFrameTimingsBuffer=null;this._layersGpuProfile=new Map;this._gpuCurUtilisation=NaN;this._webgpuFrameTimings=new Map;this._snapshotFormat="";this._snapshotQuality=1;this._snapshotArea=e.New(e.Rect);this._snapshotUrl="";this._snapshotResolve=this._snapshotPromise=null;this._loaderStartTime=this._isPastingToDrawingCanvas=0;this._rafId=-1;this._loadingProgress=0;this._loadingprogress_handler=l=>this._loadingProgress=l.progress;this._percentText=null;this._splashTextures={logo:null,powered:null,
website:null};this._splashFadeOutStartTime=this._splashFadeInFinishTime=this._splashFrameNumber=0;this._splashState="fade-in";this._splashDoneResolve=null;this._splashDonePromise=new Promise(l=>this._splashDoneResolve=l)}_SetGPUPowerPreference(g){this._gpuPreference=g}_SetWebGPUEnabled(g){this._isWebGPUEnabled=!!g}_SetZAxisScale(g){this._zAxisScale=g}_SetFieldOfView(g){this._fieldOfView=g}async CreateCanvas(g){this._canvas=g.canvas;this._runtime.AddDOMComponentMessageHandler("runtime","window-resize",
u=>this._OnWindowResize(u));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenchange",u=>this._OnFullscreenChange(u));this._runtime.AddDOMComponentMessageHandler("runtime","fullscreenerror",u=>this._OnFullscreenError(u));this._canvas.addEventListener("webglcontextlost",u=>this._OnWebGLContextLost(u));this._canvas.addEventListener("webglcontextrestored",u=>this._OnWebGLContextRestored(u));this._isDocumentFullscreen=!!g.isFullscreen;var l=navigator.gpu&&this._isWebGPUEnabled;let m=!1;
if(l)try{await this._InitWebGPUContext(!0)}catch(u){this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(!0)}catch(u){this._webglRenderer=null}this.GetRenderer()||(m=!0);if(!this.GetRenderer()&&l)try{await this._InitWebGPUContext(!1)}catch(u){this._webgpuRenderer=null}if(!this.GetRenderer())try{await this._InitWebGLContext(!1)}catch(u){this._webglRenderer=null}l=this.GetRenderer();if(!l)throw Error("failed to acquire a renderer - check WebGL or WebGPU is supported");l.SetHasMajorPerformanceCaveat(m);
"normalized"===this._zAxisScale?l.SetZAxisScaleNormalized():(l.SetZAxisScaleRegular(),l.SetFovY(this._fieldOfView));this.SetSize(g.windowInnerWidth,g.windowInnerHeight,!0);this._webgpuRenderer?await this._InitWebGPU():this._webglRenderer&&await this._InitWebGL();l.SetMipmapsEnabled(this._enableMipmaps);l.SupportsGPUProfiling()&&(this._gpuLastUtilisation=0);for(const u of this._runtime._GetAllEffectLists()){for(const w of u.GetAllEffectTypes())w._InitRenderer(l);u.UpdateActiveEffects()}}async _InitWebGPUContext(g){g=
{powerPreference:this._gpuPreference,depth:this._runtime.Uses3DFeatures(),failIfMajorPerformanceCaveat:g,canSampleBackbuffer:this._runtime.UsesAnyBackgroundBlending(),canSampleDepth:this._runtime.UsesAnyDepthSampling()};this._webgpuRenderer=e.New(e.Gfx.WebGPURenderer);await this._webgpuRenderer.Create(this._canvas,g)}async _InitWebGLContext(g){g={powerPreference:this._gpuPreference,enableGpuProfiling:!0,depth:this._runtime.Uses3DFeatures(),canSampleDepth:this._runtime.UsesAnyDepthSampling(),failIfMajorPerformanceCaveat:g};
"Android"===e.Platform.OS&&"Chromium"===e.Platform.BrowserEngine&&75>e.Platform.BrowserVersionNumber&&(console.warn("[Construct 3] Disabling WebGL 2 because this device appears to be affected by crbug.com/934823. Install software updates to avoid this."),g.maxWebGLVersion=1);"standard"===this._runtime.GetCompositingMode()?g.alpha=!0:(g.alpha=!1,g.lowLatency=!0);this._webglRenderer=e.New(e.Gfx.WebGLRenderer,this._canvas,g);await this._webglRenderer.InitState()}async _InitWebGPU(){if(this._shaderData){const g=
[];for(const [l,m]of Object.entries(this._shaderData)){m.src=m.wgsl;const u=e.Gfx.WebGPUShaderProgram.GetDefaultVertexShaderSource();g.push(this._webgpuRenderer.CreateShaderProgram(m,u,l))}await Promise.all(g)}}async _InitWebGL(){if(this._shaderData){const g=[];for(const [l,m]of Object.entries(this._shaderData)){m.src=m.glsl;const u=e.Gfx.WebGLShaderProgram.GetDefaultVertexShaderSource();g.push(this._webglRenderer.CreateShaderProgram(m,u,l))}await Promise.all(g);this._webglRenderer.ResetLastProgram();
this._webglRenderer.SetTextureFillMode()}this._webglRenderer.SupportsGPUProfiling()&&(this._gpuFrameTimingsBuffer=e.New(e.Gfx.WebGLQueryResultBuffer,this._webglRenderer))}Release(){this._canvas=this._webglRenderer=this._runtime=null}_OnWindowResize(g){const l=this._runtime;if(!l.IsExportToVideo()){var m=g.devicePixelRatio;l.IsInWorker()&&(self.devicePixelRatio=m);l._SetDevicePixelRatio(m);this._isDocumentFullscreen=!!g.isFullscreen;this.SetSize(g.innerWidth,g.innerHeight);l.UpdateRender();l.IsDebug()&&
(l.HitBreakpoint()||self.C3Debugger.IsDebuggerPaused())&&l.Render()}}_OnFullscreenChange(g){this._isDocumentFullscreen=!!g.isFullscreen;this.SetSize(g.innerWidth,g.innerHeight,!0);this._runtime.UpdateRender()}_OnFullscreenError(g){this._isDocumentFullscreen=!!g.isFullscreen;this.SetSize(g.innerWidth,g.innerHeight,!0);this._runtime.UpdateRender()}SetSize(g,l,m=!1){g=Math.floor(g);l=Math.floor(l);if(0>=g||0>=l)throw Error("invalid size");if(this._windowInnerWidth!==g||this._windowInnerHeight!==l||m){this._windowInnerWidth=
g;this._windowInnerHeight=l;m=this.GetCurrentFullscreenMode();"letterbox-scale"===m?this._CalculateLetterboxScale(g,l):"letterbox-integer-scale"===m?this._CalculateLetterboxIntegerScale(g,l):"off"===m?this._CalculateFixedSizeCanvas(g,l):this._CalculateFullsizeCanvas(g,l);this._UpdateFullscreenScalingQuality(m);this._canvas.width=this._canvasDeviceWidth;this._canvas.height=this._canvasDeviceHeight;this._runtime.PostComponentMessageToDOM("canvas","update-size",{marginLeft:this._canvasCssOffsetX,marginTop:this._canvasCssOffsetY,
styleWidth:this._canvasCssWidth,styleHeight:this._canvasCssHeight});g=this.GetRenderer();g.SetSize(this._canvasDeviceWidth,this._canvasDeviceHeight,!0);for(var u of this._availableAdditionalRenderTargets)g.DeleteRenderTarget(u);e.clearArray(this._availableAdditionalRenderTargets);g.CalculatePerspectiveMatrix(this._defaultProjectionMatrix,this.GetDrawWidth()/this.GetDrawHeight());u=this._runtime.GetLayoutManager();u.SetAllLayerProjectionChanged();u.SetAllLayerMVChanged()}}GetDefaultProjectionMatrix(){return this._defaultProjectionMatrix}_CalculateLetterboxScale(g,
l){const m=this._runtime.GetDevicePixelRatio(),u=this._runtime.GetOriginalViewportWidth(),w=this._runtime.GetOriginalViewportHeight(),q=u/w;g/l>q?(this._canvasCssWidth=Math.round(l*q),this._canvasCssHeight=l,this._canvasCssOffsetX=Math.floor((g-this._canvasCssWidth)/2),this._canvasCssOffsetY=0):(this._canvasCssWidth=g,this._canvasCssHeight=Math.round(g/q),this._canvasCssOffsetX=0,this._canvasCssOffsetY=Math.floor((l-this._canvasCssHeight)/2));this._canvasDeviceWidth=Math.round(this._canvasCssWidth*
m);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*m);this._runtime.SetViewportSize(u,w)}_CalculateLetterboxIntegerScale(g,l){const m=this._runtime.GetDevicePixelRatio();1!==m&&(g+=1,l+=1);const u=this._runtime.GetOriginalViewportWidth(),w=this._runtime.GetOriginalViewportHeight();var q=u/w;q=g/l>q?l*q*m/u:g/q*m/w;1<q?q=Math.floor(q):1>q&&(q=1/Math.ceil(1/q));this._canvasDeviceWidth=Math.round(u*q);this._canvasDeviceHeight=Math.round(w*q);this._canvasCssWidth=this._canvasDeviceWidth/m;this._canvasCssHeight=
this._canvasDeviceHeight/m;this._canvasCssOffsetX=Math.max(Math.floor((g-this._canvasCssWidth)/2),0);this._canvasCssOffsetY=Math.max(Math.floor((l-this._canvasCssHeight)/2),0);this._runtime.SetViewportSize(u,w)}_CalculateFullsizeCanvas(g,l){const m=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=g;this._canvasCssHeight=l;this._canvasDeviceWidth=Math.round(this._canvasCssWidth*m);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*m);this._canvasCssOffsetY=this._canvasCssOffsetX=0;g=
this.GetDisplayScale();this._runtime.SetViewportSize(this._canvasCssWidth/g,this._canvasCssHeight/g)}_CalculateFixedSizeCanvas(g,l){const m=this._runtime.GetDevicePixelRatio();this._canvasCssWidth=this._runtime.GetViewportWidth();this._canvasCssHeight=this._runtime.GetViewportHeight();this._canvasDeviceWidth=Math.round(this._canvasCssWidth*m);this._canvasDeviceHeight=Math.round(this._canvasCssHeight*m);this.IsDocumentFullscreen()?(this._canvasCssOffsetX=Math.floor((g-this._canvasCssWidth)/2),this._canvasCssOffsetY=
Math.floor((l-this._canvasCssHeight)/2)):this._canvasCssOffsetY=this._canvasCssOffsetX=0;this._runtime.SetViewportSize(this._runtime.GetViewportWidth(),this._runtime.GetViewportHeight())}_UpdateFullscreenScalingQuality(g){if("high"===this._wantFullscreenScalingQuality)this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high";else{let m;if("off"===this.GetCurrentFullscreenMode()){var l=this._runtime.GetViewportWidth();m=this._runtime.GetViewportHeight()}else l=
this._runtime.GetOriginalViewportWidth(),m=this._runtime.GetOriginalViewportHeight();this._canvasDeviceWidth<l||this._canvasDeviceHeight<m?(this._drawWidth=this._canvasDeviceWidth,this._drawHeight=this._canvasDeviceHeight,this._fullscreenScalingQuality="high"):(this._drawWidth=l,this._drawHeight=m,this._fullscreenScalingQuality="low","scale-inner"===g?(g=l/m,l=this._windowInnerWidth/this._windowInnerHeight,l<g?this._drawWidth=this._drawHeight*l:l>g&&(this._drawHeight=this._drawWidth/l)):"scale-outer"===
g&&(g=l/m,l=this._windowInnerWidth/this._windowInnerHeight,l>g?this._drawWidth=this._drawHeight*l:l<g&&(this._drawHeight=this._drawWidth/l)))}}GetRuntime(){return this._runtime}GetCanvas(){return this._canvas}GetEffectChainManager(){return this._effectChainManager}IsDocumentFullscreen(){return this._isDocumentFullscreen}SetFullscreenMode(g){if(!b.has(g))throw Error("invalid fullscreen mode");this._fullscreenMode=g;g=this._runtime.GetLayoutManager();g.SetAllLayerProjectionChanged();g.SetAllLayerMVChanged()}GetFullscreenMode(){return this._fullscreenMode}SetDocumentFullscreenMode(g){if(!b.has(g))throw Error("invalid fullscreen mode");
this._documentFullscreenMode=g;g=this._runtime.GetLayoutManager();g.SetAllLayerProjectionChanged();g.SetAllLayerMVChanged()}GetDocumentFullscreenMode(){return this._documentFullscreenMode}GetCurrentFullscreenMode(){return this.IsDocumentFullscreen()?this.GetDocumentFullscreenMode():this.GetFullscreenMode()}SetFullscreenScalingQuality(g){if(!a.has(g))throw Error("invalid fullscreen scaling quality");this._wantFullscreenScalingQuality=g;this._runtime.GetLayoutManager().SetAllLayerProjectionChanged()}GetSetFullscreenScalingQuality(){return this._wantFullscreenScalingQuality}GetCurrentFullscreenScalingQuality(){return this._fullscreenScalingQuality}static _FullscreenModeNumberToString(g){switch(g){case 0:return"off";
case 1:return"crop";case 2:return"scale-inner";case 3:return"scale-outer";case 4:return"letterbox-scale";case 5:return"letterbox-integer-scale";default:throw Error("invalid fullscreen mode");}}GetLastWidth(){return this._windowInnerWidth}GetLastHeight(){return this._windowInnerHeight}GetDrawWidth(){return this._drawWidth}GetDrawHeight(){return this._drawHeight}SetMipmapsEnabled(g){this._enableMipmaps=!!g}_SetTextureAnisotropy(g){this._textureAnisotropy=g}GetTextureAnisotropy(){return this._textureAnisotropy}IsRendererContextLost(){return this.GetRenderer().IsContextLost()}_OnWebGLContextLost(g){console.log("[Construct 3] WebGL context lost");
g.preventDefault();this._availableAdditionalRenderTargets=[];this._usedAdditionalRenderTargets.clear();this._webglRenderer.OnContextLost();this._runtime._OnWebGLContextLost()}async _OnWebGLContextRestored(g){await this._webglRenderer.OnContextRestored();await this._LoadWebGLShaderPrograms();for(const l of this._runtime._GetAllEffectLists())for(const m of l.GetAllEffectTypes())m._InitRenderer(this._webglRenderer);await this._runtime._OnWebGLContextRestored();console.log("[Construct 3] WebGL context restored")}GetWebGLRenderer(){return this._webglRenderer}GetWebGPURenderer(){return this._webgpuRenderer}GetRenderer(){return this._webgpuRenderer||
this._webglRenderer}GetRenderScale(){return"low"===this._fullscreenScalingQuality?1/this._runtime.GetDevicePixelRatio():this.GetDisplayScale()}GetDisplayScale(){const g=this.GetCurrentFullscreenMode();if("off"===g||"crop"===g)return 1;const l=this._runtime.GetOriginalViewportWidth(),m=this._runtime.GetOriginalViewportHeight(),u=l/m,w=this._canvasDeviceWidth/this._canvasDeviceHeight;return"scale-inner"!==g&&w>u||"scale-inner"===g&&w<u?this._canvasCssHeight/m:this._canvasCssWidth/l}GetEffectLayerScaleParam(){return"low"===
this.GetCurrentFullscreenScalingQuality()?1:this.GetDisplayScale()}GetEffectDevicePixelRatioParam(){return"low"===this.GetCurrentFullscreenScalingQuality()?1:this._runtime.GetDevicePixelRatio()}SetDeviceTransformOffset(g,l){this._deviceTransformOffX=g;this._deviceTransformOffY=l}SetDeviceTransform(g,l,m,u=!0){l=l||this._drawWidth;m=m||this._drawHeight;const w=l/2+this._deviceTransformOffX,q=m/2+this._deviceTransformOffY;if(u){u=this.GetDefaultProjectionMatrix();if(l!==this._drawWidth||m!==this._drawHeight)g.CalculatePerspectiveMatrix(c,
l/m),u=c;g.SetProjectionMatrix(u)}l=g.CalculateLookAtModelView2(w,q,g.GetDefaultCameraZ(m),w,q,0,m);g.SetModelViewMatrix(l)}SetCssTransform(g,l=!0){var m=this.GetCssWidth();const u=this.GetCssHeight();m/=2;const w=u/2;l&&g.SetProjectionMatrix(this.GetDefaultProjectionMatrix());l=g.CalculateLookAtModelView2(m,w,g.GetDefaultCameraZ(u),m,w,0,u);g.SetModelViewMatrix(l)}GetDeviceWidth(){return this._canvasDeviceWidth}GetDeviceHeight(){return this._canvasDeviceHeight}GetCssWidth(){return this._canvasCssWidth}GetCssHeight(){return this._canvasCssHeight}GetCanvasClientX(){return this._canvasCssOffsetX}GetCanvasClientY(){return this._canvasCssOffsetY}GetAdditionalRenderTarget(g){g.depth=
this._runtime.Uses3DFeatures();const l=this._availableAdditionalRenderTargets,m=l.findIndex(w=>w.IsCompatibleWithOptions(g));let u;-1!==m?(u=l[m],l.splice(m,1)):u=this.GetRenderer().CreateRenderTarget(g);this._usedAdditionalRenderTargets.add(u);return u}ReleaseAdditionalRenderTarget(g){if(!this._usedAdditionalRenderTargets.has(g))throw Error("render target not in use");this._usedAdditionalRenderTargets.delete(g);this._availableAdditionalRenderTargets.push(g)}GetEffectCompositorRenderTarget(){const g=
{sampling:this._runtime.GetSampling()};"low"===this.GetCurrentFullscreenScalingQuality()&&(g.width=this.GetDrawWidth(),g.height=this.GetDrawHeight());return this.GetAdditionalRenderTarget(g)}ReleaseEffectCompositorRenderTarget(g){this.ReleaseAdditionalRenderTarget(g)}*activeLayersGpuProfiles(){for(const g of this._runtime.GetLayoutManager().runningLayouts())for(const l of g.GetLayers()){const m=this._layersGpuProfile.get(l);m&&(yield m)}}GetLayerTimingsBuffer(g){if(!this.GetRenderer().SupportsGPUProfiling())return null;
let l=this._layersGpuProfile.get(g);l||(l={name:g.GetName(),timingsBuffer:e.New(e.Gfx.WebGLQueryResultBuffer,this._webglRenderer),curUtilisation:0,lastUtilisation:0},this._layersGpuProfile.set(g,l));return l.timingsBuffer}_Update1sFrameRange(){const g=this.GetRenderer();if(g.SupportsGPUProfiling()&&0===this._gpuTimeEndFrame){this._gpuTimeEndFrame=g.GetFrameNumber();this._gpuCurUtilisation=NaN;for(const l of this.activeLayersGpuProfiles())l.curUtilisation=NaN}}_UpdateTick(){this._webglRenderer&&this._webglRenderer.SupportsGPUProfiling()&&
this._UpdateTick_WebGL();this._webgpuRenderer&&this._webgpuRenderer.SupportsGPUProfiling()&&this._UpdateTick_WebGPU()}_UpdateTick_WebGL(){if(isNaN(this._gpuCurUtilisation)&&(this._gpuCurUtilisation=this._gpuFrameTimingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),!isNaN(this._gpuCurUtilisation))){if(this._runtime.IsDebug())for(const g of this.activeLayersGpuProfiles())if(g.curUtilisation=g.timingsBuffer.GetFrameRangeResultSum(this._gpuTimeStartFrame,this._gpuTimeEndFrame),
isNaN(g.curUtilisation))return;this._gpuFrameTimingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame);this._gpuLastUtilisation=Math.min(this._gpuCurUtilisation,1);if(this._runtime.IsDebug()){for(const g of this.activeLayersGpuProfiles())g.timingsBuffer.DeleteAllBeforeFrameNumber(this._gpuTimeEndFrame),g.lastUtilisation=Math.min(g.curUtilisation,1);self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,[...this.activeLayersGpuProfiles()])}this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=
0}}GetGPUFrameTimingsBuffer(){return this._gpuFrameTimingsBuffer}_UpdateTick_WebGPU(){if(0!==this._gpuTimeEndFrame){for(var g=this._gpuTimeStartFrame;g<this._gpuTimeEndFrame;++g){var l=this._webgpuFrameTimings.get(g);if(l&&!l.HasResult())return}l=this._runtime.GetMainRunningLayout();g=e.MakeFilledArray(l.GetLayerCount()+1,0);for(var m=this._gpuTimeStartFrame;m<this._gpuTimeEndFrame;++m){var u=this._webgpuFrameTimings.get(m);if(u){u=u.GetResult();for(let w=0,q=Math.min(g.length,u.length/2);w<q;++w){const t=
u[2*w],p=u[2*w+1];g[w]=0===Number(t)||0===Number(p)?NaN:g[w]+Number(p-t)/1E9}}}this._gpuLastUtilisation=e.clamp(g[0],0,1);if(this._runtime.IsDebug()){m=[];l=l.GetLayers();for(let w=0,q=Math.min(l.length,g.length-1);w<q;++w)m.push({name:l[w].GetName(),lastUtilisation:e.clamp(g[w+1],0,1)});self.C3Debugger.UpdateGPUProfile(this._gpuLastUtilisation,m)}for(g=this._gpuTimeStartFrame;g<this._gpuTimeEndFrame;++g)this._webgpuFrameTimings.delete(g);this._gpuTimeStartFrame=this._gpuTimeEndFrame;this._gpuTimeEndFrame=
0}}_AddWebGPUFrameTiming(g){this._webgpuFrameTimings.set(this._webgpuRenderer.GetFrameNumber(),g)}GetGPUUtilisation(){return this._gpuLastUtilisation}SnapshotCanvas(g,l,m,u,w,q){this._snapshotFormat=g;this._snapshotQuality=l;this._snapshotArea.setWH(m,u,w,q);return this._snapshotPromise?this._snapshotPromise:this._snapshotPromise=new Promise(t=>{this._snapshotResolve=t})}_MaybeTakeSnapshot(){if(this._snapshotFormat){var g=this._canvas,l=this._snapshotArea,m=e.clamp(Math.floor(l.getLeft()),0,g.width),
u=e.clamp(Math.floor(l.getTop()),0,g.height),w=l.width();w=0===w?g.width-m:e.clamp(Math.floor(w),0,g.width-m);l=l.height();l=0===l?g.height-u:e.clamp(Math.floor(l),0,g.height-u);(0!==m||0!==u||w!==g.width||l!==g.height)&&0<w&&0<l&&(g=e.CreateCanvas(w,l),g.getContext("2d").drawImage(this._canvas,m,u,w,l,0,0,w,l));e.CanvasToBlob(g,this._snapshotFormat,this._snapshotQuality).then(q=>{this._snapshotUrl=URL.createObjectURL(q);this._snapshotPromise=null;this._snapshotResolve(this._snapshotUrl)});this._snapshotFormat=
"";this._snapshotQuality=1}}GetCanvasSnapshotUrl(){return this._snapshotUrl}SetIsPastingToDrawingCanvas(g){g?this._isPastingToDrawingCanvas++:this._isPastingToDrawingCanvas--}IsPastingToDrawingCanvas(){return 0<this._isPastingToDrawingCanvas}InitLoadingScreen(g){this._webglRenderer&&(2===g?(this._percentText=e.New(e.Gfx.RendererText,this.GetRenderer()),this._percentText.SetIsAsync(!1),this._percentText.SetFontName("Arial"),this._percentText.SetFontSize(16),this._percentText.SetHorizontalAlignment("center"),
this._percentText.SetVerticalAlignment("center"),this._percentText.SetSize(300,200)):0===g?(g=this._runtime.GetLoadingLogoAsset())&&g.LoadStaticTexture(this._webglRenderer).catch(l=>console.warn("[C3 runtime] Failed to create texture for loading logo: ",l)):4===g&&(this._LoadSvgSplashImage("splash-images/splash-logo.svg").then(l=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(l):this._splashTextures.logo=l}).catch(l=>console.warn("Failed to load splash image: ",l)),this._LoadBitmapSplashImage("splash-images/splash-poweredby-512.png").then(l=>
{"done"===this._splashState?this._webglRenderer.DeleteTexture(l):this._splashTextures.powered=l}).catch(l=>console.warn("Failed to load splash image: ",l)),this._LoadBitmapSplashImage("splash-images/splash-website-512.png").then(l=>{"done"===this._splashState?this._webglRenderer.DeleteTexture(l):this._splashTextures.website=l}).catch(l=>console.warn("Failed to load splash image: ",l))))}async _LoadSvgSplashImage(g){g=(new URL(g,this._runtime.GetBaseURL())).toString();g=await e.FetchBlob(g);g=await this._runtime.RasterSvgImage(g,
2048,2048);return await this._webglRenderer.CreateStaticTextureAsync(g,{mipMapQuality:"high"})}async _LoadBitmapSplashImage(g){g=(new URL(g,this._runtime.GetBaseURL())).toString();g=await e.FetchBlob(g);return await this._webglRenderer.CreateStaticTextureAsync(g,{mipMapQuality:"high"})}HideCordovaSplashScreen(){this._runtime.PostComponentMessageToDOM("runtime","hide-cordova-splash")}StartLoadingScreen(){this._loaderStartTime=Date.now();this._runtime.Dispatcher().addEventListener("loadingprogress",
this._loadingprogress_handler);this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen());3!==this._runtime.GetLoaderStyle()&&this.HideCordovaSplashScreen()}async EndLoadingScreen(){if(this._webglRenderer){this._loadingProgress=1;var g=this._runtime.GetLoaderStyle();4===g&&await this._splashDonePromise;this._splashDonePromise=this._splashDoneResolve=null;-1!==this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=-1);this._runtime.Dispatcher().removeEventListener("loadingprogress",this._loadingprogress_handler);
this._loadingprogress_handler=null;this._percentText&&(this._percentText.Release(),this._percentText=null);this._runtime.ReleaseLoadingLogoAsset();this._webglRenderer.Start();this._splashTextures.logo&&(this._webglRenderer.DeleteTexture(this._splashTextures.logo),this._splashTextures.logo=null);this._splashTextures.powered&&(this._webglRenderer.DeleteTexture(this._splashTextures.powered),this._splashTextures.powered=null);this._splashTextures.website&&(this._webglRenderer.DeleteTexture(this._splashTextures.website),
this._splashTextures.website=null);this._webglRenderer.ClearRgba(0,0,0,0);this._webglRenderer.Finish();this._splashState="done";this._gpuTimeStartFrame=this._webglRenderer.GetFrameNumber();3===g&&this.HideCordovaSplashScreen()}}_DrawLoadingScreen(){if(-1!==this._rafId){var g=this._webglRenderer;if(g){g.Start();this._rafId=-1;var l=this._runtime.GetAssetManager().HasHadErrorLoading(),m=this._runtime.GetLoaderStyle();3!==m&&(this.SetCssTransform(g),g.ClearRgba(0,0,0,0),g.ResetColor(),g.SetTextureFillMode(),
g.SetTexture(null));if(0===m)this._DrawProgressBarAndLogoLoadingScreen(l);else if(1===m)this._DrawProgressBarLoadingScreen(l,120,0);else if(2===m)this._DrawPercentTextLoadingScreen(l);else if(3===m)e.noop();else if(4===m)this._DrawSplashLoadingScreen(l);else throw Error("invalid loader style");g.Finish();this._rafId=requestAnimationFrame(()=>this._DrawLoadingScreen())}}}_DrawPercentTextLoadingScreen(g){g?this._percentText.SetColorRgb(1,0,0):this._percentText.SetColorRgb(.6,.6,.6);this._percentText.SetText(Math.round(100*
this._loadingProgress)+"%");g=this._canvasCssWidth/2;const l=this._canvasCssHeight/2;f.setRect(g-150,l-100,g+150,l+100);this._webglRenderer.SetTexture(this._percentText.GetTexture());this._webglRenderer.Quad3(f,this._percentText.GetTexRect())}_DrawProgressBarLoadingScreen(g,l,m){const u=this._webglRenderer;u.SetColorFillMode();g?u.SetColorRgba(1,0,0,1):u.SetColorRgba(.118,.565,1,1);g=this._canvasCssWidth/2;const w=this._canvasCssHeight/2,q=l/2;h.setWH(g-q,w-4+m,Math.floor(l*this._loadingProgress),
8);u.Rect(h);h.setWH(g-q,w-4+m,l,8);h.offset(-.5,-.5);h.inflate(.5,.5);u.SetColorRgba(0,0,0,1);u.LineRect2(h);h.inflate(1,1);u.SetColorRgba(1,1,1,1);u.LineRect2(h)}_DrawProgressBarAndLogoLoadingScreen(g){var l=this._runtime.GetLoadingLogoAsset();if(l)if(l=l.GetTexture()){var m=l.GetWidth(),u=l.GetHeight(),w=this._canvasCssWidth/2,q=this._canvasCssHeight/2,t=m/2;u/=2;f.setRect(w-t,q-u,w+t,q+u);this._webglRenderer.SetTexture(l);this._webglRenderer.Quad(f);this._DrawProgressBarLoadingScreen(g,m,u+16)}else this._DrawProgressBarLoadingScreen(g,
120,0);else this._DrawProgressBarLoadingScreen(g,120,0)}_DrawSplashLoadingScreen(g){const l=this._webglRenderer,m=this._splashTextures.logo,u=this._splashTextures.powered,w=this._splashTextures.website,q=Date.now();0===this._splashFrameNumber&&(this._loaderStartTime=q);const t=this._runtime.IsPreview()||this._runtime.IsFBInstantAvailable()&&!this._runtime.IsCordova(),p=t?0:200,r=t?0:3E3;let x=1;"fade-in"===this._splashState?x=Math.min((q-this._loaderStartTime)/300,1):"fade-out"===this._splashState&&
(x=Math.max(1-(q-this._splashFadeOutStartTime)/300,0));l.SetColorFillMode();l.SetColorRgba(.231*x,.251*x,.271*x,x);h.set(0,0,this._canvasCssWidth,this._canvasCssHeight);l.Rect(h);const y=Math.ceil(this._canvasCssWidth),D=Math.ceil(this._canvasCssHeight);let G;256<this._canvasCssHeight?(l.SetColorRgba(.302*x,.334*x,.365*x,x),G=Math.max(.005*D,2),h.setWH(0,.8*D-G/2,y,G),l.Rect(h),g?l.SetColorRgba(x,0,0,x):l.SetColorRgba(.161*x,.953*x,.816*x,x),g=y*this._loadingProgress,h.setWH(.5*y-g/2,.8*D-G/2,g,G),
l.Rect(h),l.SetColorRgba(x,x,x,x),l.SetTextureFillMode(),u&&(g=1.5*e.clamp(.22*D,105,.6*y),G=g/8,h.setWH(.5*y-g/2,.2*D-G/2,g,G),l.SetTexture(u),l.Rect(h)),m&&(G=g=Math.min(.395*D,.95*y),h.setWH(.5*y-g/2,.485*D-G/2,g,G),l.SetTexture(m),l.Rect(h)),w&&(g=1.5*e.clamp(.22*D,105,.6*y),G=g/8,h.setWH(.5*y-g/2,.868*D-G/2,g,G),l.SetTexture(w),l.Rect(h))):(l.SetColorRgba(.302*x,.334*x,.365*x,x),G=Math.max(.005*D,2),h.setWH(0,.85*D-G/2,y,G),l.Rect(h),g?l.SetColorRgba(x,0,0,x):l.SetColorRgba(.161*x,.953*x,.816*
x,x),g=y*this._loadingProgress,h.setWH(.5*y-g/2,.85*D-G/2,g,G),l.Rect(h),l.SetColorRgba(x,x,x,x),l.SetTextureFillMode(),m&&(G=g=.55*D,h.setWH(.5*y-g/2,.45*D-G/2,g,G),l.SetTexture(m),l.Rect(h)));this._splashFrameNumber++;"fade-in"===this._splashState&&300<=q-this._loaderStartTime&&2<=this._splashFrameNumber&&(this._splashState="wait",this._splashFadeInFinishTime=q);"wait"===this._splashState&&q-this._splashFadeInFinishTime>=r&&1<=this._loadingProgress&&(this._splashState="fade-out",this._splashFadeOutStartTime=
q);("fade-out"===this._splashState&&q-this._splashFadeOutStartTime>=300+p||t&&1<=this._loadingProgress&&500>q-this._loaderStartTime)&&this._splashDoneResolve()}}}
{"use strict";const e=self.C3,b=self.C3Debugger,a={messagePort:null,baseUrl:"",headless:!1,hasDom:!0,isInWorker:!1,useAudio:!0,projectData:"",exportType:""};let d=!0;e.Runtime=class extends e.DefendedBase{constructor(c){c=Object.assign({},a,c);super();this._messagePort=c.messagePort;this._baseUrl=c.baseUrl;this._previewUrl=c.previewUrl;this._isHeadless=!!c.headless;this._hasDom=!!c.hasDom;this._isInWorker=!!c.isInWorker;d=c.ife;this._useAudio=!!c.useAudio;this._exportType=c.exportType;this._isiOSCordova=
!!c.isiOSCordova;this._isiOSWebView=!!c.isiOSWebView;this._isFBInstantAvailable=!!c.isFBInstantAvailable;this._opusWasmScriptUrl=c.opusWasmScriptUrl;this._opusWasmBinaryUrl=c.opusWasmBinaryUrl;this._isDebugging=this._breakpointsEnabled=this._isDebug=!("preview"!==this._exportType||!c.isDebug);this._debuggingDisabled=0;this._additionalLoadPromises=[];this._additionalCreatePromises=[];this._isUsingCreatePromises=!1;this._appId=this._projectUniqueId=this._projectVersion=this._projectName="";this._originalViewportHeight=
this._originalViewportWidth=0;this._devicePixelRatio=self.devicePixelRatio;this._loaderStyle=this._viewportHeight=this._viewportWidth=this._parallaxYorigin=this._parallaxXorigin=0;this._usesLoaderLayout=!1;this._isLoading=!0;this._usesAnyDepthSampling=this._usesAnyBackgroundBlending=!1;this._loadingLogoAsset=null;this._assetManager=e.New(e.AssetManager,this,c);this._layoutManager=e.New(e.LayoutManager,this);this._eventSheetManager=e.New(e.EventSheetManager,this);this._pluginManager=e.New(e.PluginManager,
this);this._collisionEngine=e.New(e.CollisionEngine,this);this._timelineManager=e.New(e.TimelineManager,this);this._transitionManager=e.New(e.TransitionManager,this);this._allObjectClasses=[];this._objectClassesByName=new Map;this._objectClassesBySid=new Map;this._familyCount=0;this._allContainers=[];this._allEffectLists=[];this._currentLayoutStack=[];this._instancesPendingCreate=[];this._instancesPendingDestroy=new Map;this._isFlushingPendingInstances=this._hasPendingInstances=!1;this._nextUid=this._objectCount=
0;this._instancesByUid=new Map;this._instancesToReleaseAtEndOfTick=new Set;this._instancesToReleaseAffectedObjectClasses=new Set;this._objectReferenceTable=[];this._jsPropNameTable=[];this._canvasManager=null;this._uses3dFeatures=!1;this._framerateMode="vsync";this._compositingMode="standard";this._sampling="trilinear";this._isPixelRoundingEnabled=!1;this._needRender=!0;this._isPausedOnBlur=this._pauseOnBlur=!1;this._exportToVideo=null;this._tickCallbacks={normal:f=>{this._ruafId=this._rafId=-1;this.Tick(f)},
tickOnly:f=>{this._ruafId=-1;this.Tick(f,!1,"skip-render")},renderOnly:()=>{this._rafId=-1;this.Render()}};this._ruafId=this._rafId=-1;this._execCount=this._tickCountNoSave=this._tickCount=0;this._hasStartedTicking=this._isInTick=this._hasStarted=!1;this._isLayoutFirstTick=!0;this._suspendCount=0;this._scheduleTriggersThrottle=new e.PromiseThrottle(1);this._randomNumberCallback=()=>Math.random();this._dt=this._dt1=this._lastTickTime=this._startTime=0;this._timeScale=1;this._minimumFramerate=30;this._gameTime=
e.New(e.KahanSum);this._gameTimeRaw=e.New(e.KahanSum);this._wallTime=e.New(e.KahanSum);this._fpsFrameCount=-1;this._mainThreadTime=this._mainThreadTimeCounter=this._fps=this._fpsLastTime=0;this._isLoadingState=!1;this._loadFromSlotName=this._saveToSlotName="";this._loadFromJson=null;this._lastSaveJson="";this._savegamesStorage=this._projectStorage=null;this._dispatcher=e.New(e.Event.Dispatcher);this._domEventHandlers=new Map;this._pendingResponsePromises=new Map;this._nextDomResponseId=0;this._isReadyToHandleEvents=
this._didRequestDeviceMotionEvent=this._didRequestDeviceOrientationEvent=!1;this._waitingToHandleEvents=[];this._eventObjects={pretick:e.New(e.Event,"pretick",!1),tick:e.New(e.Event,"tick",!1),tick2:e.New(e.Event,"tick2",!1),instancedestroy:e.New(e.Event,"instancedestroy",!1),beforelayoutchange:e.New(e.Event,"beforelayoutchange",!1),layoutchange:e.New(e.Event,"layoutchange",!1)};this._eventObjects.instancedestroy.instance=null;this._userScriptDispatcher=e.New(e.Event.Dispatcher);this._userScriptEventObjects=
null;this._behInstsToTick=e.New(e.RedBlackSet,e.BehaviorInstance.SortByTickSequence);this._behInstsToPostTick=e.New(e.RedBlackSet,e.BehaviorInstance.SortByTickSequence);this._behInstsToTick2=e.New(e.RedBlackSet,e.BehaviorInstance.SortByTickSequence);this._jobScheduler=e.New(e.JobSchedulerRuntime,this,c.jobScheduler);c.canvas&&(this._canvasManager=e.New(e.CanvasManager,this));this._messagePort.onmessage=f=>this._OnMessageFromDOM(f.data);this.AddDOMComponentMessageHandler("runtime","visibilitychange",
f=>this._OnVisibilityChange(f));this.AddDOMComponentMessageHandler("runtime","opus-decode",f=>this._WasmDecodeWebMOpus(f.arrayBuffer));this.AddDOMComponentMessageHandler("runtime","get-remote-preview-status-info",()=>this._GetRemotePreviewStatusInfo());this.AddDOMComponentMessageHandler("runtime","js-invoke-function",f=>this._InvokeFunctionFromJS(f));this.AddDOMComponentMessageHandler("runtime","go-to-last-error-script",self.goToLastErrorScript);this._dispatcher.addEventListener("window-blur",f=>
this._OnWindowBlur(f));this._dispatcher.addEventListener("window-focus",()=>this._OnWindowFocus());this._timelineManager.AddRuntimeListeners();this._iRuntime=null;this._interfaceMap=new WeakMap;this._commonScriptInterfaces={keyboard:null,mouse:null,touch:null}}static Create(c){return e.New(e.Runtime,c)}Release(){e.clearArray(this._allObjectClasses);this._objectClassesByName.clear();this._objectClassesBySid.clear();this._layoutManager.Release();this._layoutManager=null;this._eventSheetManager.Release();
this._eventSheetManager=null;this._pluginManager.Release();this._pluginManager=null;this._assetManager.Release();this._assetManager=null;this._collisionEngine.Release();this._collisionEngine=null;this._timelineManager.Release();this._timelineManager=null;this._transitionManager.Release();this._transitionManager=null;this._canvasManager&&(this._canvasManager.Release(),this._canvasManager=null);this._dispatcher.Release();this._tickEvent=this._dispatcher=null}["_OnMessageFromDOM"](c){const f=c.type;
if("event"===f)this._OnEventFromDOM(c);else if("result"===f)this._OnResultFromDOM(c);else throw Error(`unknown message '${f}'`);}_OnEventFromDOM(c){if(this._isReadyToHandleEvents){var f=c.component,h=c.handler,g=c.data,l=c.dispatchOpts,m=!(!l||!l.dispatchRuntimeEvent);l=!(!l||!l.dispatchUserScriptEvent);var u=c.responseId;if("runtime"===f&&(m&&(c=new e.Event(h),c.data=g,this._dispatcher.dispatchEventAndWaitAsyncSequential(c)),l)){c=new e.Event(h,!0);for(const [w,q]of Object.entries(g))c[w]=q;this.DispatchUserScriptEvent(c)}if(c=
this._domEventHandlers.get(f))if(c=c.get(h)){m=null;try{m=c(g)}catch(w){console.error(`Exception in '${f}' handler '${h}':`,w);null!==u&&this._PostResultToDOM(u,!1,""+w);return}null!==u&&(m&&m.then?m.then(w=>this._PostResultToDOM(u,!0,w)).catch(w=>{console.error(`Rejection from '${f}' handler '${h}':`,w);this._PostResultToDOM(u,!1,""+w)}):this._PostResultToDOM(u,!0,m))}else m||l||console.warn(`[Runtime] No DOM handler '${h}' for component '${f}'`);else m||l||console.warn(`[Runtime] No DOM event handlers for component '${f}'`)}else this._waitingToHandleEvents.push(c)}_PostResultToDOM(c,
f,h){this._messagePort.postMessage({type:"result",responseId:c,isOk:f,result:h})}_OnResultFromDOM(c){const f=c.responseId,h=c.isOk;c=c.result;const g=this._pendingResponsePromises.get(f);h?g.resolve(c):g.reject(c);this._pendingResponsePromises.delete(f)}AddDOMComponentMessageHandler(c,f,h){let g=this._domEventHandlers.get(c);g||(g=new Map,this._domEventHandlers.set(c,g));if(g.has(f))throw Error(`[Runtime] Component '${c}' already has handler '${f}'`);g.set(f,h)}PostComponentMessageToDOM(c,f,h){this._messagePort.postMessage({type:"event",
component:c,handler:f,data:h,responseId:null})}PostComponentMessageToDOMAsync(c,f,h){const g=this._nextDomResponseId++,l=new Promise((m,u)=>{this._pendingResponsePromises.set(g,{resolve:m,reject:u})});this._messagePort.postMessage({type:"event",component:c,handler:f,data:h,responseId:g});return l}PostToDebugger(c){if(!this.IsDebug())throw Error("not in debug mode");this.PostComponentMessageToDOM("runtime","post-to-debugger",c)}async Init(c){this.IsDebug()?await b.Init(this):self.C3Debugger&&self.C3Debugger.InitPreview(this);
var [f]=await Promise.all([this._assetManager.FetchJson("data.json"),this._MaybeLoadOpusDecoder(),this._jobScheduler.Init()]);this._LoadDataJson(f);await this._InitialiseCanvas(c);this.IsPreview()||console.info("Made with Construct 3, the game and app creator :: https://www.construct.net");this.GetWebGLRenderer()?(f=this.GetWebGLRenderer(),console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with WebGL ${f.GetWebGLVersionNumber()} [${f.GetUnmaskedRenderer()}] (${f.IsDesynchronized()?
"desynchronized":"standard"} compositing)`)):this.GetWebGPURenderer()&&console.info(`[C3 runtime] Hosted in ${this.IsInWorker()?"worker":"DOM"}, rendering with experimental WebGPU`);this.GetRenderer().HasMajorPerformanceCaveat()&&console.warn("[C3 runtime] The renderer indicates a major performance caveat. Software rendering may be in use. This can result in significantly degraded performance.");this._isReadyToHandleEvents=!0;for(const h of this._waitingToHandleEvents)this._OnEventFromDOM(h);e.clearArray(this._waitingToHandleEvents);
this._canvasManager&&this._canvasManager.StartLoadingScreen();for(const h of c.runOnStartupFunctions)this._additionalLoadPromises.push(this._RunOnStartupFunction(h));await Promise.all([this._assetManager.WaitForAllToLoad(),...this._additionalLoadPromises]);e.clearArray(this._additionalLoadPromises);if(this._assetManager.HasHadErrorLoading())this._canvasManager&&this._canvasManager.HideCordovaSplashScreen();else return this._canvasManager&&await this._canvasManager.EndLoadingScreen(),await this._dispatcher.dispatchEventAndWaitAsync(new e.Event("beforeruntimestart")),
await this.Start(),this._messagePort.postMessage({type:"runtime-ready"}),this}async _RunOnStartupFunction(c){try{await c(this._iRuntime)}catch(f){console.error("[C3 runtime] Error in runOnStartup function: ",f)}}_LoadDataJson(c){c=c.project;this._projectName=c[0];this._projectVersion=c[16];this._projectUniqueId=c[31];this._appId=c[38];const f=c[39]||"loading-logo.png";this._isPixelRoundingEnabled=!!c[9];this._originalViewportWidth=this._viewportWidth=c[10];this._originalViewportHeight=this._viewportHeight=
c[11];this._parallaxXorigin=this._originalViewportWidth/2;this._parallaxYorigin=this._originalViewportHeight/2;this._compositingMode=c[36];this._framerateMode=c[37];"low-latency"===this._compositingMode&&this.IsAndroidWebView()&&77>=e.Platform.BrowserVersionNumber&&(console.warn("[C3 runtime] Desynchronized (low-latency) compositing is enabled, but is disabled in the Android WebView <=77 due to crbug.com/1008842. Reverting to synchronized (standard) compositing."),this._compositingMode="standard");
this._uses3dFeatures=!!c[40];this._sampling=c[14];this._usesAnyBackgroundBlending=c[15];this._usesAnyDepthSampling=c[17];this._usesLoaderLayout=!!c[18];this._loaderStyle=c[19];this._nextUid=c[21];this._pauseOnBlur=c[22];const h=this._assetManager;h._SetAudioFiles(c[7],c[25]);h._SetMediaSubfolder(c[8]);h._SetFontsSubfolder(c[32]);h._SetIconsSubfolder(c[28]);h._SetWebFonts(c[29]);if(0===this._loaderStyle){let q="";this.IsPreview()?h._HasLocalUrlBlob(f)&&(q=h.GetLocalUrlAsBlobUrl(f)):q=h.GetIconsSubfolder()+
f;q&&(this._loadingLogoAsset=h.LoadImage({url:q}))}this._canvasManager&&(this._canvasManager.SetFullscreenMode(e.CanvasManager._FullscreenModeNumberToString(c[12])),this._canvasManager.SetFullscreenScalingQuality(c[23]?"high":"low"),this._canvasManager.SetMipmapsEnabled(0!==c[24]),this._canvasManager._SetGPUPowerPreference(c[34]),this._canvasManager._SetTextureAnisotropy(c[41]),this._canvasManager._SetWebGPUEnabled(c[13]),this._canvasManager._SetZAxisScale(c[30]),this._canvasManager._SetFieldOfView(c[26]));
this._pluginManager.CreateSystemPlugin();this._objectReferenceTable=self.C3_GetObjectRefTable();for(var g of c[2])this._pluginManager.CreatePlugin(g);this._objectReferenceTable=self.C3_GetObjectRefTable();this._LoadJsPropNameTable();for(var l of c[3])g=e.ObjectClass.Create(this,this._allObjectClasses.length,l),this._allObjectClasses.push(g),this._objectClassesByName.set(g.GetName().toLowerCase(),g),this._objectClassesBySid.set(g.GetSID(),g);for(const q of c[4])this._allObjectClasses[q[0]]._LoadFamily(q);
for(var m of c[27])l=m.map(q=>this._allObjectClasses[q]),this._allContainers.push(e.New(e.Container,this,l));for(const q of this._allObjectClasses)q._OnAfterCreate();for(const q of c[5])this._layoutManager.Create(q);(m=c[1])&&(m=this._layoutManager.GetLayoutByName(m))&&this._layoutManager.SetFirstLayout(m);for(var u of c[33])this._timelineManager.Create(u);for(var w of c[35])this._transitionManager.Create(w);this._InitScriptInterfaces();for(const q of c[6])this._eventSheetManager.Create(q);this._eventSheetManager._PostInit();
this._InitGlobalVariableScriptInterface();e.clearArray(this._objectReferenceTable);this.FlushPendingInstances();u="any";w=c[20];1===w?u="portrait":2===w&&(u="landscape");this.PostComponentMessageToDOM("runtime","set-target-orientation",{targetOrientation:u});if(c=c[42])this._exportToVideo=new self.C3ExportToVideo(this,c),this._framerateMode="unlimited-frame",this._canvasManager.SetFullscreenMode("off"),this._devicePixelRatio=1,self.devicePixelRatio=1,this.PostComponentMessageToDOM("runtime","set-exporting-to-video",
{message:this._exportToVideo.GetExportingMessageForPercent(0)})}GetLoaderStyle(){return this._loaderStyle}IsExportToVideo(){return null!==this._exportToVideo}GetExportVideoDuration(){return this._exportToVideo.GetDuration()}GetExportVideoFramerate(){return this._exportToVideo.GetFramerate()}_InitExportToVideo(){return this._exportToVideo.Init({width:this._canvasManager.GetDeviceWidth(),height:this._canvasManager.GetDeviceHeight()})}_ExportToVideoAddFrame(){return this._exportToVideo.AddFrame(this._canvasManager.GetCanvas(),
this.GetGameTime())}_ExportToVideoFinish(){return this._exportToVideo.Finish()}IsFBInstantAvailable(){return this._isFBInstantAvailable}IsLoading(){return this._isLoading}AddLoadPromise(c){this._additionalLoadPromises.push(c)}SetUsingCreatePromises(c){this._isUsingCreatePromises=!!c}AddCreatePromise(c){this._isUsingCreatePromises&&this._additionalCreatePromises.push(c)}GetCreatePromises(){return this._additionalCreatePromises}_GetNextFamilyIndex(){return this._familyCount++}GetFamilyCount(){return this._familyCount}_AddEffectList(c){this._allEffectLists.push(c)}_GetAllEffectLists(){return this._allEffectLists}async _InitialiseCanvas(c){this._canvasManager&&
(await this._canvasManager.CreateCanvas(c),this._canvasManager.InitLoadingScreen(this._loaderStyle))}async _MaybeLoadOpusDecoder(){if(!this._assetManager.IsAudioFormatSupported("audio/webm; codecs=opus")){var c=null;try{c=this.IsiOSCordova()&&this._assetManager.IsFileProtocol()?await this._assetManager.CordovaFetchLocalFileAsArrayBuffer(this._opusWasmBinaryUrl):await this._assetManager.FetchArrayBuffer(this._opusWasmBinaryUrl)}catch(f){console.info("Failed to fetch Opus decoder WASM; assuming project has no Opus audio.",
f);return}c?this.AddJobWorkerBuffer(c,"opus-decoder-wasm"):this.AddJobWorkerBlob(null,"opus-decoder-wasm");await this.AddJobWorkerScripts([this._opusWasmScriptUrl])}}async _WasmDecodeWebMOpus(c){return await this.AddJob("OpusDecode",{arrayBuffer:c},[c])}async Start(){this._hasStarted=!0;this._startTime=Date.now();if(this._usesLoaderLayout){for(var c of this._allObjectClasses)c.IsFamily()||c.IsOnLoaderLayout()||!c.IsWorldType()||c.OnCreate();this._assetManager.WaitForAllToLoad().then(()=>{this._isLoading=
!1;this._OnLoadFinished()})}else this._isLoading=!1;this._assetManager.SetInitialLoadFinished();this.IsDebug()&&b.RuntimeInit(d);for(const f of this._layoutManager.GetAllLayouts())f._CreateGlobalNonWorlds();this.IsExportToVideo()&&await this._InitExportToVideo();c=this._layoutManager.GetFirstLayout();await c._Load(null,this.GetRenderer());await c._StartRunning(!0);this._fpsLastTime=performance.now();this._usesLoaderLayout||this._OnLoadFinished();(await this.PostComponentMessageToDOMAsync("runtime",
"before-start-ticking")).isSuspended&&!this.IsExportToVideo()?this._suspendCount++:this.Tick()}_OnLoadFinished(){this.Trigger(e.Plugins.System.Cnds.OnLoadFinished,null,null);this.PostComponentMessageToDOM("runtime","register-sw")}GetObjectReference(c){c=Math.floor(c);const f=this._objectReferenceTable;if(0>c||c>=f.length)throw Error("invalid object reference");return f[c]}_LoadJsPropNameTable(){for(const c of self.C3_JsPropNameTable){const f=e.first(Object.keys(c));this._jsPropNameTable.push(f)}}GetJsPropName(c){c=
Math.floor(c);const f=this._jsPropNameTable;if(0>c||c>=f.length)throw Error("invalid prop reference");return f[c]}HasDOM(){return this._hasDom}IsHeadless(){return this._isHeadless}IsInWorker(){return this._isInWorker}GetBaseURL(){return this._baseUrl}GetPreviewURL(){return this._previewUrl}GetEventSheetManager(){return this._eventSheetManager}GetEventStack(){return this._eventSheetManager.GetEventStack()}GetCurrentEventStackFrame(){return this._eventSheetManager.GetCurrentEventStackFrame()}GetCurrentEvent(){return this._eventSheetManager.GetCurrentEvent()}GetCurrentCondition(){return this._eventSheetManager.GetCurrentCondition()}IsCurrentConditionFirst(){return 0===
this.GetCurrentEventStackFrame().GetConditionIndex()}GetCurrentAction(){return this._eventSheetManager.GetCurrentAction()}GetPluginManager(){return this._pluginManager}GetSystemPlugin(){return this._pluginManager.GetSystemPlugin()}GetObjectClassByIndex(c){c=Math.floor(c);if(0>c||c>=this._allObjectClasses.length)throw new RangeError("invalid index");return this._allObjectClasses[c]}GetObjectClassByName(c){return this._objectClassesByName.get(c.toLowerCase())||null}GetObjectClassBySID(c){return this._objectClassesBySid.get(c)||
null}GetSingleGlobalObjectClassByCtor(c){return(c=this._pluginManager.GetPluginByConstructorFunction(c))?c.GetSingleGlobalObjectClass():null}GetAllObjectClasses(){return this._allObjectClasses}*allInstances(){for(const c of this._allObjectClasses)c.IsFamily()||(yield*c.instances())}Dispatcher(){return this._dispatcher}UserScriptDispatcher(){return this._userScriptDispatcher}DispatchUserScriptEvent(c){c.runtime=this.GetIRuntime();const f=this.IsDebug()&&!this._eventSheetManager.IsInEventEngine();f&&
b.StartMeasuringScriptTime();this._userScriptDispatcher.dispatchEvent(c);f&&b.AddScriptTime()}DispatchUserScriptEventAsyncWait(c){c.runtime=this.GetIRuntime();return this._userScriptDispatcher.dispatchEventAndWaitAsync(c)}GetOriginalViewportWidth(){return this._originalViewportWidth}GetOriginalViewportHeight(){return this._originalViewportHeight}SetOriginalViewportSize(c,f){if(this._originalViewportWidth!==c||this._originalViewportHeight!==f)this._originalViewportWidth=c,this._originalViewportHeight=
f,c=this.GetLayoutManager(),c.SetAllLayerProjectionChanged(),c.SetAllLayerMVChanged()}GetViewportWidth(){return this._viewportWidth}GetViewportHeight(){return this._viewportHeight}SetViewportSize(c,f){if(this._viewportWidth!==c||this._viewportHeight!==f)this._viewportWidth=c,this._viewportHeight=f,c=this.GetLayoutManager(),c.SetAllLayerProjectionChanged(),c.SetAllLayerMVChanged()}_SetDevicePixelRatio(c){this.IsExportToVideo()||(this._devicePixelRatio=c)}GetDevicePixelRatio(){return this._devicePixelRatio}GetParallaxXOrigin(){return this._parallaxXorigin}GetParallaxYOrigin(){return this._parallaxYorigin}GetCanvasManager(){return this._canvasManager}GetDrawWidth(){return this._canvasManager?
this._canvasManager.GetDrawWidth():this._viewportWidth}GetDrawHeight(){return this._canvasManager?this._canvasManager.GetDrawHeight():this._viewportHeight}GetRenderScale(){return this._canvasManager?this._canvasManager.GetRenderScale():1}GetDisplayScale(){return this._canvasManager?this._canvasManager.GetDisplayScale():1}GetEffectLayerScaleParam(){return this._canvasManager?this._canvasManager.GetEffectLayerScaleParam():1}GetEffectDevicePixelRatioParam(){return this._canvasManager?this._canvasManager.GetEffectDevicePixelRatioParam():
1}GetCanvasClientX(){return this._canvasManager?this._canvasManager.GetCanvasClientX():0}GetCanvasClientY(){return this._canvasManager?this._canvasManager.GetCanvasClientY():0}GetCanvasCssWidth(){return this._canvasManager?this._canvasManager.GetCssWidth():0}GetCanvasCssHeight(){return this._canvasManager?this._canvasManager.GetCssHeight():0}GetFullscreenMode(){return this._canvasManager?this._canvasManager.GetFullscreenMode():"off"}GetAdditionalRenderTarget(c){return this._canvasManager?this._canvasManager.GetAdditionalRenderTarget(c):
null}ReleaseAdditionalRenderTarget(c){this._canvasManager&&this._canvasManager.ReleaseAdditionalRenderTarget(c)}UsesAnyBackgroundBlending(){return this._usesAnyBackgroundBlending}UsesAnyDepthSampling(){return this._usesAnyDepthSampling}GetGPUUtilisation(){return this._canvasManager?this._canvasManager.GetGPUUtilisation():NaN}IsLinearSampling(){return"nearest"!==this.GetSampling()}GetFramerateMode(){return this._framerateMode}GetCompositingMode(){return this._compositingMode}GetSampling(){return this._sampling}UsesLoaderLayout(){return this._usesLoaderLayout}GetLoadingLogoAsset(){return this._loadingLogoAsset}ReleaseLoadingLogoAsset(){this._loadingLogoAsset&&
(this._loadingLogoAsset.Release(),this._loadingLogoAsset=null)}GetLayoutManager(){return this._layoutManager}GetMainRunningLayout(){return this._layoutManager.GetMainRunningLayout()}GetTimelineManager(){return this._timelineManager}GetTransitionManager(){return this._transitionManager}GetAssetManager(){return this._assetManager}LoadImage(c){return this._assetManager.LoadImage(c)}CreateInstance(c,f,h,g,l){return this.CreateInstanceFromData(c,f,!1,h,g,!1,l,void 0,l)}CreateInstanceFromData(c,f,h,g,l,
m,u,w,q){var t=null;let p=null;if(c instanceof e.ObjectClass){p=c;if(p.IsFamily()){c=p.GetFamilyMembers();var r=Math.floor(this.Random()*c.length);p=c[r]}t=p.GetDefaultInstanceData()}else t=c,p=this.GetObjectClassByIndex(t[1]);var x=p.GetPlugin().IsWorldType();if(this._isLoading&&x&&!p.IsOnLoaderLayout())return null;const y=f;x||(f=null);var D=h&&!m&&t&&!this._instancesByUid.has(t[2])?t[2]:this._nextUid++;r=t?t[0]:null;c=e.New(e.Instance,{runtime:this,objectType:p,layer:f,worldData:r,instVarData:t?
t[3]:null,uid:D});this._instancesByUid.set(D,c);D=null;x&&(D=c.GetWorldInfo(),"undefined"!==typeof g&&"undefined"!==typeof l&&(D.SetX(g),D.SetY(l)),p._SetAnyCollisionCellChanged(!0));f&&(q||f._AddInstance(c,!0),1===f.GetParallaxX()&&1===f.GetParallaxY()||p._SetAnyInstanceParallaxed(!0),f.GetLayout().MaybeLoadTexturesFor(p));this._objectCount++;let G=!0;if(w){var A=w.GetObjectClass();A.IsInContainer()&&p.IsInContainer()&&(w=p.GetContainer(),A=A.GetContainer(),w===A&&(G=!1))}if(p.IsInContainer()&&!h&&
!m&&G){for(var F of p.GetContainer().objectTypes())F!==p&&(w=this.CreateInstanceFromData(F,y,!1,D?D.GetX():g,D?D.GetY():l,!0,!1,void 0,q),c._AddSibling(w));for(var J of c.siblings()){J._AddSibling(c);for(const B of c.siblings())J!==B&&J._AddSibling(B)}}x&&!h&&u&&this._CreateChildInstancesFromData(c,r,D,f,g,l,q);if(p.IsInContainer()&&!h&&!m&&u)for(const B of c.siblings())if(h=B.GetWorldInfo())F=B.GetPlugin(),J=B.GetObjectClass().GetDefaultInstanceData()[0],F.IsWorldType()?this._CreateChildInstancesFromData(B,
J,h,f,h.GetX(),h.GetY(),q):this._CreateChildInstancesFromData(B,J,h,f,void 0,void 0,q);!m&&u&&("undefined"===typeof g&&(g=r[0]),"undefined"===typeof l&&(l=r[1]),f=D.GetTopParent(),g=g-D.GetX()+f.GetX(),l=l-D.GetY()+f.GetY(),f.SetXY(g,l));p._SetIIDsStale();l=t?e.cloneArray(t[5]):null;t=t?t[4].map(B=>e.cloneArray(B)):null;(x=x&&r&&r[13])&&c._SetHasTilemap();c._CreateSdkInstance(l,t);x&&(r=r[13],c.GetSdkInstance().LoadTilemapData(r[2],r[0],r[1]));this._instancesPendingCreate.push(c);this._hasPendingInstances=
!0;this.IsDebug()&&b.InstanceCreated(c);return c}_CreateChildInstancesFromData(c,f,h,g,l,m,u){var w=h.GetSceneGraphZIndexExportData(),q=h.GetSceneGraphChildrenExportData();c.GetWorldInfo().SetSceneGraphZIndex(w);if(q){"undefined"===typeof l&&(l=f[0]);"undefined"===typeof m&&(m=f[1]);w=new Set;h=f[0];f=f[1];for(const y of q){var t=y[1],p=y[2];q=y[3];var r=!!y[4];const D=y[5];p=this._layoutManager.GetLayoutBySID(y[0]).GetLayer(t).GetInitialInstanceData(p);t=this.GetObjectClassByIndex(p[1]);var x=c.HasSibling(t);
const G=w.has(t);x&&!G&&r?(r=c.GetSibling(t),x=l+p[0][0]-h,p=m+p[0][1]-f,r.GetWorldInfo().SetXY(x,p),r.GetWorldInfo().SetSceneGraphZIndex(D),c.AddChild(r,{transformX:!!(q>>0&1),transformY:!!(q>>1&1),transformWidth:!!(q>>2&1),transformHeight:!!(q>>3&1),transformAngle:!!(q>>4&1),destroyWithParent:!!(q>>5&1),transformZElevation:!!(q>>6&1)}),w.add(t)):(t=this.CreateInstanceFromData(p,g,!1,l+p[0][0]-h,m+p[0][1]-f,!1,!0,c,u),t.GetWorldInfo().SetSceneGraphZIndex(D),c.AddChild(t,{transformX:!!(q>>0&1),transformY:!!(q>>
1&1),transformWidth:!!(q>>2&1),transformHeight:!!(q>>3&1),transformAngle:!!(q>>4&1),destroyWithParent:!!(q>>5&1),transformZElevation:!!(q>>6&1)}))}}}DestroyInstance(c){if(!this._instancesToReleaseAtEndOfTick.has(c)){var f=c.GetObjectClass(),h=this._instancesPendingDestroy.get(f);if(h){if(h.has(c))return;h.add(c)}else h=new Set,h.add(c),this._instancesPendingDestroy.set(f,h);this.IsDebug()&&b.InstanceDestroyed(c);c._MarkDestroyed();this._hasPendingInstances=!0;if(c.IsInContainer())for(const g of c.siblings())this.DestroyInstance(g);
for(const g of c.children())g.GetDestroyWithParent()&&this.DestroyInstance(g);this._layoutManager.IsEndingLayout()||this._isLoadingState||(f=this.GetEventSheetManager(),f.BlockFlushingInstances(!0),c._TriggerOnDestroyed(),f.BlockFlushingInstances(!1));c._FireDestroyedScriptEvents(this._layoutManager.IsEndingLayout())}}FlushPendingInstances(){this._hasPendingInstances&&(this._isFlushingPendingInstances=!0,this._FlushInstancesPendingCreate(),this._FlushInstancesPendingDestroy(),this._hasPendingInstances=
this._isFlushingPendingInstances=!1,this.UpdateRender())}_FlushInstancesPendingCreate(){for(const c of this._instancesPendingCreate){const f=c.GetObjectClass();f._AddInstance(c);for(const h of f.GetFamilies())h._AddInstance(c),h._SetIIDsStale()}e.clearArray(this._instancesPendingCreate)}_FlushInstancesPendingDestroy(){this._dispatcher.SetDelayRemoveEventsEnabled(!0);for(const [c,f]of this._instancesPendingDestroy.entries())this._FlushInstancesPendingDestroyForObjectClass(c,f),f.clear();this._instancesPendingDestroy.clear();
this._dispatcher.SetDelayRemoveEventsEnabled(!1)}_FlushInstancesPendingDestroyForObjectClass(c,f){for(const g of f){var h=this._eventObjects.instancedestroy;h.instance=g;this._dispatcher.dispatchEvent(h);this._instancesByUid.delete(g.GetUID());if(h=g.GetWorldInfo())h._RemoveFromCollisionCells(),h._RemoveFromRenderCells(),h._MarkDestroyed();this._instancesToReleaseAtEndOfTick.add(g);this._objectCount--}e.arrayRemoveAllInSet(c.GetInstances(),f);c._SetIIDsStale();this._instancesToReleaseAffectedObjectClasses.add(c);
0===c.GetInstances().length&&c._SetAnyInstanceParallaxed(!1);for(const g of c.GetFamilies())e.arrayRemoveAllInSet(g.GetInstances(),f),g._SetIIDsStale(),this._instancesToReleaseAffectedObjectClasses.add(g);if(c.GetPlugin().IsWorldType()){c=new Set([...f].map(g=>g.GetWorldInfo().GetLayer()));for(const g of c)g._RemoveAllInstancesInSet(f)}}_GetInstancesPendingCreate(){return this._instancesPendingCreate}*instancesPendingCreateForObjectClass(c){for(const f of this._GetInstancesPendingCreate())c.IsFamily()?
f.GetObjectClass().BelongsToFamily(c)&&(yield f):f.GetObjectClass()===c&&(yield f)}_GetNewUID(){return this._nextUid++}_MapInstanceByUID(c,f){this._instancesByUid.set(c,f)}_OnWebGLContextLost(){this._dispatcher.dispatchEvent(e.New(e.Event,"webglcontextlost"));this.SetSuspended(!0);for(var c of this._allObjectClasses)!c.IsFamily()&&c.HasLoadedTextures()&&c.ReleaseTextures();(c=this.GetMainRunningLayout())&&c._OnWebGLContextLost();e.ImageInfo.OnWebGLContextLost();e.ImageAsset.OnWebGLContextLost()}async _OnWebGLContextRestored(){await this.GetMainRunningLayout()._Load(null,
this.GetWebGLRenderer());this._dispatcher.dispatchEvent(e.New(e.Event,"webglcontextrestored"));this.SetSuspended(!1);this.UpdateRender()}_OnVisibilityChange(c){this.SetSuspended(c.hidden)}_OnWindowBlur(c){this.IsPreview()&&this._pauseOnBlur&&!e.Platform.IsMobile&&!c.data.parentHasFocus&&(this.SetSuspended(!0),this._isPausedOnBlur=!0)}_OnWindowFocus(){this._isPausedOnBlur&&(this.SetSuspended(!1),this._isPausedOnBlur=!1)}_RequestAnimationFrame(){const c=this._tickCallbacks;"vsync"===this._framerateMode?
-1===this._rafId&&(this._rafId=self.requestAnimationFrame(c.normal)):"unlimited-tick"===this._framerateMode?(-1===this._ruafId&&(this._ruafId=e.RequestUnlimitedAnimationFrame(c.tickOnly)),-1===this._rafId&&(this._rafId=self.requestAnimationFrame(c.renderOnly))):-1===this._ruafId&&(this._ruafId=e.RequestUnlimitedAnimationFrame(c.normal))}_CancelAnimationFrame(){-1!==this._rafId&&(self.cancelAnimationFrame(this._rafId),this._rafId=-1);-1!==this._ruafId&&(e.CancelUnlimitedAnimationFrame(this._ruafId),
this._ruafId=-1)}IsSuspended(){return 0<this._suspendCount}SetSuspended(c){if(!this.IsExportToVideo()){var f=this.IsSuspended();this._suspendCount+=c?1:-1;0>this._suspendCount&&(this._suspendCount=0);c=this.IsSuspended();!f&&c?(console.log("[Construct 3] Suspending"),this._CancelAnimationFrame(),this._dispatcher.dispatchEvent(e.New(e.Event,"suspend")),this.Trigger(e.Plugins.System.Cnds.OnSuspend,null,null)):f&&!c&&(console.log("[Construct 3] Resuming"),this._fpsLastTime=this._lastTickTime=f=performance.now(),
this._mainThreadTimeCounter=this._mainThreadTime=this._fps=this._fpsFrameCount=0,this._dispatcher.dispatchEvent(e.New(e.Event,"resume")),this.Trigger(e.Plugins.System.Cnds.OnResume,null,null),this.HitBreakpoint()||this.Tick(f))}}_AddBehInstToTick(c){this._behInstsToTick.Add(c)}_AddBehInstToPostTick(c){this._behInstsToPostTick.Add(c)}_AddBehInstToTick2(c){this._behInstsToTick2.Add(c)}_RemoveBehInstToTick(c){this._behInstsToTick.Remove(c)}_RemoveBehInstToPostTick(c){this._behInstsToPostTick.Remove(c)}_RemoveBehInstToTick2(c){this._behInstsToTick2.Remove(c)}_BehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);
for(const c of this._behInstsToTick)c.Tick();this._behInstsToTick.SetQueueingEnabled(!1)}_BehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const c of this._behInstsToPostTick)c.PostTick();this._behInstsToPostTick.SetQueueingEnabled(!1)}_BehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const c of this._behInstsToTick2)c.Tick2();this._behInstsToTick2.SetQueueingEnabled(!1)}*_DebugBehaviorTick(){this._behInstsToTick.SetQueueingEnabled(!0);for(const c of this._behInstsToTick){const f=
c.Tick();e.IsIterator(f)&&(yield*f)}this._behInstsToTick.SetQueueingEnabled(!1)}*_DebugBehaviorPostTick(){this._behInstsToPostTick.SetQueueingEnabled(!0);for(const c of this._behInstsToPostTick){const f=c.PostTick();e.IsIterator(f)&&(yield*f)}this._behInstsToPostTick.SetQueueingEnabled(!1)}*_DebugBehaviorTick2(){this._behInstsToTick2.SetQueueingEnabled(!0);for(const c of this._behInstsToTick2){const f=c.Tick2();e.IsIterator(f)&&(yield*f)}this._behInstsToTick2.SetQueueingEnabled(!1)}async Tick(c,f,
h){this._hasStartedTicking=!0;const g="background-wake"===h;h="background-wake"!==h&&"skip-render"!==h;if(this._hasStarted&&(!this.IsSuspended()||f||g)){f=performance.now();this._isInTick=!0;this._MeasureDt(c||0);c=this.Step_BeforePreTick();this.IsDebugging()&&await c;c=this._dispatcher.dispatchEventAndWait_AsyncOptional(this._eventObjects.pretick);c instanceof Promise&&await c;c=this.Step_AfterPreTick();this.IsDebugging()&&await c;this._NeedsHandleSaveOrLoad()&&await this._HandleSaveOrLoad();this.GetLayoutManager().IsPendingChangeMainLayout()&&
await this._MaybeChangeLayout();c=this.Step_RunEventsEtc();this.IsDebugging()&&await c;h&&this.Render();if(this.IsExportToVideo()&&(await this._ExportToVideoAddFrame(),this.GetGameTime()>=this.GetExportVideoDuration())){this._ExportToVideoFinish();return}this.IsSuspended()||g||this._RequestAnimationFrame();this._tickCount++;this._tickCountNoSave++;this._execCount++;this._isInTick=!1;this._mainThreadTimeCounter+=performance.now()-f}}async Step_BeforePreTick(){const c=this._eventSheetManager,f=this.IsDebug();
this.FlushPendingInstances();c.BlockFlushingInstances(!0);this.PushCurrentLayout(this.GetMainRunningLayout());f&&b.StartMeasuringTime();this.IsDebugging()?await c.DebugRunScheduledWaits():c.RunScheduledWaits();f&&b.AddEventsTime();this.PopCurrentLayout();c.BlockFlushingInstances(!1);this.FlushPendingInstances();c.BlockFlushingInstances(!0)}async Step_AfterPreTick(){const c=this.IsDebug(),f=this.IsDebugging(),h=this._dispatcher,g=this._eventObjects,l=this._userScriptEventObjects;c&&b.StartMeasuringTime();
f?await this.DebugIterateAndBreak(this._DebugBehaviorTick()):this._BehaviorTick();f?await this.DebugIterateAndBreak(this._DebugBehaviorPostTick()):this._BehaviorPostTick();c&&b.AddBehaviorTickTime();c&&b.StartMeasuringTime();f?await this.DebugFireGeneratorEventAndBreak(g.tick):h.dispatchEvent(g.tick);c&&b.AddPluginTickTime();this._eventSheetManager.BlockFlushingInstances(!1);this.DispatchUserScriptEvent(l.tick)}async Step_RunEventsEtc(){const c=this._eventSheetManager,f=this._dispatcher,h=this._eventObjects,
g=this.IsDebug(),l=this.IsDebugging();g&&b.StartMeasuringTime();l?await c.DebugRunEvents(this._layoutManager):c.RunEvents(this._layoutManager);g&&b.AddEventsTime();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();this._isLayoutFirstTick=!1;c.BlockFlushingInstances(!0);g&&b.StartMeasuringTime();l?await this.DebugIterateAndBreak(this._DebugBehaviorTick2()):this._BehaviorTick2();g&&b.AddBehaviorTickTime();g&&b.StartMeasuringTime();l?await this.DebugFireGeneratorEventAndBreak(h.tick2):
f.dispatchEvent(h.tick2);g&&b.AddPluginTickTime();c.BlockFlushingInstances(!1);l&&await c.RunQueuedDebugTriggersAsync()}_ReleaseInstancesAtEndOfTick(){if(0!==this._instancesToReleaseAtEndOfTick.size){var c=this._dispatcher;c.SetDelayRemoveEventsEnabled(!0);for(const f of this._instancesToReleaseAffectedObjectClasses)f.GetSolStack().RemoveInstances(this._instancesToReleaseAtEndOfTick);this._instancesToReleaseAffectedObjectClasses.clear();this._eventSheetManager.RemoveInstancesFromScheduledWaits(this._instancesToReleaseAtEndOfTick);
for(const f of this._instancesToReleaseAtEndOfTick)f.Release();this._instancesToReleaseAtEndOfTick.clear();c.SetDelayRemoveEventsEnabled(!1)}}async _MaybeChangeLayout(){const c=this.GetLayoutManager();let f=0;for(;c.IsPendingChangeMainLayout()&&10>f++;)await this._DoChangeLayout(c.GetPendingChangeMainLayout())}_MeasureDt(c){let f=0;this.IsExportToVideo()?this._dt1=f=1/this.GetExportVideoFramerate():0!==this._lastTickTime&&(f=Math.max(c-this._lastTickTime,0)/1E3,.5<f&&(f=0),this._dt1=Math.min(f,1/
this._minimumFramerate));this._lastTickTime=c;this._dt=this._dt1*this._timeScale;this._gameTime.Add(this._dt);this._gameTimeRaw.Add(f*this._timeScale);this._wallTime.Add(this._dt1);this._canvasManager&&this._canvasManager._UpdateTick();1E3<=c-this._fpsLastTime&&(this._fpsLastTime+=1E3,1E3<=c-this._fpsLastTime&&(this._fpsLastTime=c),this._fps=this._fpsFrameCount,this._fpsFrameCount=0,this._mainThreadTime=Math.min(this._mainThreadTimeCounter/1E3,1),this._mainThreadTimeCounter=0,this._canvasManager&&
this._canvasManager._Update1sFrameRange(),this._collisionEngine._Update1sStats(),this.IsDebug()&&b.Update1sPerfStats());this._fpsFrameCount++}async _DoChangeLayout(c){const f=this._dispatcher,h=this.GetLayoutManager().GetMainRunningLayout();await h._StopRunning();h._Unload(c,this.GetRenderer());h===c&&this._eventSheetManager.ClearAllScheduledWaits();this._collisionEngine.ClearRegisteredCollisions();this._ReleaseInstancesAtEndOfTick();f.dispatchEvent(this._eventObjects.beforelayoutchange);e.Asyncify.SetHighThroughputMode(!0);
await c._Load(h,this.GetRenderer());e.Asyncify.SetHighThroughputMode(!1);await c._StartRunning(!1);f.dispatchEvent(this._eventObjects.layoutchange);this.UpdateRender();this._isLayoutFirstTick=!0;this.FlushPendingInstances()}UpdateRender(){this._needRender=!0}GetWebGLRenderer(){return this._canvasManager?this._canvasManager.GetWebGLRenderer():null}GetWebGPURenderer(){return this._canvasManager?this._canvasManager.GetWebGPURenderer():null}GetRenderer(){return this._canvasManager?this._canvasManager.GetRenderer():
null}Render(){const c=this._canvasManager;if(c&&!c.IsRendererContextLost()){var f=this.GetRenderer(),h=f.SupportsGPUProfiling(),g=h&&f.IsWebGL();h=h&&f.IsWebGPU();g&&f.CheckForQueryResults();if(this._needRender||this.IsExportToVideo()){var l=this._layoutManager.GetMainRunningLayout();f.Start();var m=this.IsDebug();m&&b.StartMeasuringTime();this._needRender=!1;var u=null;g&&(u=c.GetGPUFrameTimingsBuffer().AddTimeElapsedQuery(),f.StartQuery(u));g=null;h&&(g=f.StartFrameTiming(2*(1+l.GetLayerCount())),
f.WriteTimestamp(0));this.Uses3DFeatures()&&"low"===c.GetCurrentFullscreenScalingQuality()?f.SetFixedSizeDepthBuffer(c.GetDrawWidth(),c.GetDrawHeight()):f.SetAutoSizeDepthBuffer();this._Render(this.GetRenderer(),l);u&&f.EndQuery(u);h&&(f.WriteTimestamp(1),this._canvasManager._AddWebGPUFrameTiming(g));f.Finish();m&&(b.AddDrawCallsTime(),b.UpdateInspectHighlight());c&&c._MaybeTakeSnapshot()}else f.IncrementFrameNumber()}}_Render(c,f){c.SetTextureFillMode();c.SetAlphaBlend();c.SetColorRgba(1,1,1,1);
c.SetRenderTarget(null);c.SetTexture(null);c.SetDepthEnabled(this.Uses3DFeatures());f.Draw(c)}Trigger(c,f,h){if(!this._hasStarted)return!1;var g=!this._isInTick&&!this._eventSheetManager.IsInTrigger();let l=0;g&&(l=performance.now());const m=this.IsDebug();m&&this.SetDebuggingEnabled(!1);c=this._eventSheetManager._Trigger(this._layoutManager,c,f,h);g&&(g=performance.now()-l,this._mainThreadTimeCounter+=g,m&&b.AddTriggersTime(g));m&&this.SetDebuggingEnabled(!0);return c}DebugTrigger(c,f,h){if(!this.IsDebug())return this.Trigger(c,
f,h);if(this.HitBreakpoint())throw Error("called DebugTrigger() while stopped on breakpoint");if(!this._isInTick&&!this._eventSheetManager.IsInTrigger())throw Error("called DebugTrigger() outside of event code - use TriggerAsync() instead");return this._eventSheetManager._DebugTrigger(this._layoutManager,c,f,h)}async TriggerAsync(c,f,h){if(!this.IsDebugging())return this.Trigger(c,f,h);if(!this._hasStarted)return!1;if(this.HitBreakpoint())return this._eventSheetManager.QueueDebugTrigger(c,f,h);if(!this.GetMainRunningLayout())return this._eventSheetManager.QueueTrigger(c,
f,h);const g=performance.now();c=this._eventSheetManager._DebugTrigger(this._layoutManager,c,f,h);for(f=c.next();!f.done;)await this.DebugBreak(f.value),f=c.next();this.IsSuspended()||this._eventSheetManager.IsInTrigger()||(await this._eventSheetManager.RunQueuedDebugTriggersAsync(),this._hasStartedTicking&&!this._isInTick&&this._RequestAnimationFrame());this._mainThreadTimeCounter+=performance.now()-g;return f.value}FastTrigger(c,f,h){const g=this.IsDebug();g&&this.SetDebuggingEnabled(!1);c=this._eventSheetManager._FastTrigger(this._layoutManager,
c,f,h);g&&this.SetDebuggingEnabled(!0);return c}DebugFastTrigger(c,f,h){return this._eventSheetManager._DebugFastTrigger(this._layoutManager,c,f,h)}ScheduleTriggers(c){return this._scheduleTriggersThrottle.Add(c)}PushCurrentLayout(c){this._currentLayoutStack.push(c)}PopCurrentLayout(){if(!this._currentLayoutStack.length)throw Error("layout stack empty");this._currentLayoutStack.pop()}GetCurrentLayout(){return this._currentLayoutStack.length?this._currentLayoutStack.at(-1):this.GetMainRunningLayout()}GetDt(c){return c&&
-1!==c.GetTimeScale()?this._dt1*c.GetTimeScale():this._dt}_GetDtFast(){return this._dt}GetDt1(){return this._dt1}GetTimeScale(){return this._timeScale}SetTimeScale(c){if(isNaN(c)||0>c)c=0;this._timeScale=c}SetMinimumFramerate(c){this._minimumFramerate=e.clamp(c,1,120)}GetMinimumFramerate(){return this._minimumFramerate}GetFPS(){return this._fps}GetMainThreadTime(){return this._mainThreadTime}GetStartTime(){return this._startTime}GetGameTime(){return this._gameTime.Get()}GetGameTimeRaw(){return this._gameTimeRaw.Get()}GetWallTime(){return this._wallTime.Get()}GetTickCount(){return this._tickCount}GetTickCountNoSave(){return this._tickCountNoSave}IncrementExecCount(){++this._execCount}GetExecCount(){return this._execCount}GetObjectCount(){return this._objectCount}GetProjectName(){return this._projectName}GetProjectVersion(){return this._projectVersion}GetProjectUniqueId(){return this._projectUniqueId}GetAppId(){return this._appId}GetInstanceByUID(c){if(this._isLoadingState)throw Error("cannot call while loading state - wait until afterload event");
return this._instancesByUid.get(c)||null}_RefreshUidMap(){this._instancesByUid.clear();for(const c of this._allObjectClasses)if(!c.IsFamily())for(const f of c.GetInstances())this._instancesByUid.set(f.GetUID(),f)}IsPreview(){return"preview"===this._exportType}IsDebug(){return this._isDebug}GetExportType(){return this._exportType}IsCordova(){return"cordova"===this._exportType}IsAndroidWebView(){return"Android"===e.Platform.OS&&("cordova"===this._exportType||"playable-ad"===this._exportType||"instant-games"===
this._exportType)}IsiOSCordova(){return this._isiOSCordova}IsiOSWebView(){return this._isiOSWebView}GetCollisionEngine(){return this._collisionEngine}GetSolidBehavior(){return this._pluginManager.GetSolidBehavior()}GetJumpthruBehavior(){return this._pluginManager.GetJumpthruBehavior()}Uses3DFeatures(){return this._uses3dFeatures}GetZScaleFactor(){return this.GetRenderer().GetZAxisScaleFactor(this.GetViewportHeight())}GetDefaultCameraZ(){return this.GetRenderer().GetDefaultCameraZ(this.GetViewportHeight())}IsLayoutFirstTick(){return this._isLayoutFirstTick}SetPixelRoundingEnabled(c){c=
!!c;this._isPixelRoundingEnabled!==c&&(this._isPixelRoundingEnabled=c,this.GetLayoutManager().SetAllLayerMVChanged(),this.UpdateRender())}IsPixelRoundingEnabled(){return this._isPixelRoundingEnabled}SaveToSlot(c){this._saveToSlotName=c}LoadFromSlot(c){this._loadFromSlotName=c}LoadFromJsonString(c){this._loadFromJson=c}GetLastSaveJsonString(){return this._lastSaveJson}_NeedsHandleSaveOrLoad(){return!(!this._saveToSlotName&&!this._loadFromSlotName&&null===this._loadFromJson)}async _HandleSaveOrLoad(){this._saveToSlotName&&
(this.FlushPendingInstances(),await this._DoSaveToSlot(this._saveToSlotName),this._ClearSaveOrLoad());this._loadFromSlotName&&(await this._DoLoadFromSlot(this._loadFromSlotName),this._ClearSaveOrLoad(),this.IsDebug()&&b.StepIfPausedInDebugger());if(null!==this._loadFromJson){this.FlushPendingInstances();try{await this._DoLoadFromJsonString(this._loadFromJson),this._lastSaveJson=this._loadFromJson,await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadComplete,null),this._lastSaveJson=""}catch(c){console.error("[Construct 3] Failed to load state from JSON string: ",
c),await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadFailed,null)}this._ClearSaveOrLoad()}}_ClearSaveOrLoad(){this._loadFromSlotName=this._saveToSlotName="";this._loadFromJson=null}_GetProjectStorage(){this._projectStorage||(this._projectStorage=localforage.createInstance({name:"c3-localstorage-"+this.GetProjectUniqueId(),description:this.GetProjectName()}));return this._projectStorage}_GetSavegamesStorage(){this._savegamesStorage||(this._savegamesStorage=localforage.createInstance({name:"c3-savegames-"+
this.GetProjectUniqueId(),description:this.GetProjectName()}));return this._savegamesStorage}async _DoSaveToSlot(c){const f=await this._SaveToJsonString();try{await this._GetSavegamesStorage().setItem(c,f),console.log("[Construct 3] Saved state to storage ("+f.length+" chars)"),this._lastSaveJson=f,await this.TriggerAsync(e.Plugins.System.Cnds.OnSaveComplete,null),this._lastSaveJson=""}catch(h){console.error("[Construct 3] Failed to save state to storage: ",h),await this.TriggerAsync(e.Plugins.System.Cnds.OnSaveFailed,
null)}}async _DoLoadFromSlot(c){try{const f=await this._GetSavegamesStorage().getItem(c);if(!f)throw Error("empty slot");console.log("[Construct 3] Loaded state from storage ("+f.length+" chars)");await this._DoLoadFromJsonString(f);this._lastSaveJson=f;await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadComplete,null);this._lastSaveJson=""}catch(f){console.error("[Construct 3] Failed to load state from storage: ",f),await this.TriggerAsync(e.Plugins.System.Cnds.OnLoadFailed,null)}}async _SaveToJsonString(){const c=
{c3save:!0,version:1,rt:{time:this.GetGameTime(),timeRaw:this.GetGameTimeRaw(),walltime:this.GetWallTime(),timescale:this.GetTimeScale(),tickcount:this.GetTickCount(),execcount:this.GetExecCount(),next_uid:this._nextUid,running_layout:this.GetMainRunningLayout().GetSID(),start_time_offset:Date.now()-this._startTime},types:{},layouts:{},events:this._eventSheetManager._SaveToJson(),timelines:this._timelineManager._SaveToJson(),user_script_data:null};for(var f of this._allObjectClasses)f.IsFamily()||
f.HasNoSaveBehavior()||(c.types[f.GetSID().toString()]=f._SaveToJson());for(const h of this._layoutManager.GetAllLayouts())c.layouts[h.GetSID().toString()]=h._SaveToJson();f=this._CreateUserScriptEvent("save");f.saveData=null;await this.DispatchUserScriptEventAsyncWait(f);c.user_script_data=f.saveData;return JSON.stringify(c)}IsLoadingState(){return this._isLoadingState}async _DoLoadFromJsonString(c){var f=this.GetLayoutManager();c=JSON.parse(c);if(c.c2save)throw Error("C2 saves are incompatible with C3 runtime");
if(!c.c3save)throw Error("not valid C3 save data");if(1<c.version)throw Error("C3 save data from future version");this._dispatcher.dispatchEvent(e.New(e.Event,"beforeload"));for(var h of this.allInstances())h._OnBeforeLoad();this._isLoadingState=!0;h=c.rt;this._gameTime.Set(h.time);h.hasOwnProperty("timeRaw")&&this._gameTimeRaw.Set(h.timeRaw);this._wallTime.Set(h.walltime);this._timeScale=h.timescale;this._tickCount=h.tickcount;this._execCount=h.execcount;this._startTime=Date.now()-h.start_time_offset;
var g=h.running_layout;if(g!==this.GetMainRunningLayout().GetSID())if(g=f.GetLayoutBySID(g))await this._DoChangeLayout(g);else return;for(const [l,m]of Object.entries(c.types))g=parseInt(l,10),g=this.GetObjectClassBySID(g),!g||g.IsFamily()||g.HasNoSaveBehavior()||g._LoadFromJson(m);this.FlushPendingInstances();this._RefreshUidMap();this._isLoadingState=!1;this._nextUid=h.next_uid;for(const [l,m]of Object.entries(c.layouts))h=parseInt(l,10),(h=f.GetLayoutBySID(h))&&h._LoadFromJson(m);this._eventSheetManager._LoadFromJson(c.events);
for(const l of this._allObjectClasses)if(!l.IsFamily()&&l.IsInContainer())for(const m of l.GetInstances()){h=m.GetIID();for(const u of l.GetContainer().objectTypes())if(u!==l){g=u.GetInstances();if(0>h||h>=g.length)throw Error("missing sibling instance");m._AddSibling(g[h])}}this._timelineManager._LoadFromJson(c.timelines);f.SetAllLayerProjectionChanged();f.SetAllLayerMVChanged();this._dispatcher.dispatchEvent(e.New(e.Event,"afterload"));f=this._CreateUserScriptEvent("load");f.saveData=c.user_script_data;
await this.DispatchUserScriptEventAsyncWait(f);this.UpdateRender()}async AddJobWorkerScripts(c){c=(await Promise.all(c.map(f=>this._assetManager.FetchBlob(f)))).map(f=>URL.createObjectURL(f));this._jobScheduler.ImportScriptsToJobWorkers(c)}AddJobWorkerBlob(c,f){this._jobScheduler.SendBlobToJobWorkers(c,f)}AddJobWorkerBuffer(c,f){this._jobScheduler.SendBufferToJobWorkers(c,f)}AddJob(c,f,h){return this._jobScheduler.AddJob(c,f,h)}BroadcastJob(c,f,h){return this._jobScheduler.BroadcastJob(c,f,h)}InvokeDownload(c,
f){this.PostComponentMessageToDOM("runtime","invoke-download",{url:c,filename:f})}async RasterSvgImage(c,f,h,g,l,m){g=g||f;l=l||h;if(this.IsInWorker())return(await this.PostComponentMessageToDOMAsync("runtime","raster-svg-image",{blob:c,imageWidth:f,imageHeight:h,surfaceWidth:g,surfaceHeight:l,imageBitmapOpts:m})).imageBitmap;c=await self.C3_RasterSvgImageBlob(c,f,h,g,l);return m?await self.createImageBitmap(c,m):c}async GetSvgImageSize(c){return this.IsInWorker()?await this.PostComponentMessageToDOMAsync("runtime",
"get-svg-image-size",{blob:c}):await self.C3_GetSvgImageSize(c)}RequestDeviceOrientationEvent(){this._didRequestDeviceOrientationEvent||(this._didRequestDeviceOrientationEvent=!0,this.PostComponentMessageToDOM("runtime","enable-device-orientation"))}RequestDeviceMotionEvent(){this._didRequestDeviceMotionEvent||(this._didRequestDeviceMotionEvent=!0,this.PostComponentMessageToDOM("runtime","enable-device-motion"))}Random(){return this._randomNumberCallback()}SetRandomNumberGeneratorCallback(c){this._randomNumberCallback=
c}_GetRemotePreviewStatusInfo(){const c=this.GetWebGLRenderer();return{fps:this.GetFPS(),cpu:this.GetMainThreadTime(),gpu:this.GetGPUUtilisation(),layout:this.GetMainRunningLayout()?this.GetMainRunningLayout().GetName():"",renderer:c?c.GetUnmaskedRenderer():"<unavailable>"}}HitBreakpoint(){return this.IsDebug()?b.HitBreakpoint():!1}DebugBreak(c){return this.IsDebugging()?b.DebugBreak(c):Promise.resolve()}DebugBreakNext(){return this.IsDebugging()?b.BreakNext():!1}SetDebugBreakpointsEnabled(c){this._breakpointsEnabled=
!!c;this._UpdateDebuggingFlag()}AreDebugBreakpointsEnabled(){return this._breakpointsEnabled}IsDebugging(){return this._isDebugging}SetDebuggingEnabled(c){c?this._debuggingDisabled--:this._debuggingDisabled++;this._UpdateDebuggingFlag()}_UpdateDebuggingFlag(){this._isDebugging=this.IsDebug()&&this._breakpointsEnabled&&0===this._debuggingDisabled}IsCPUProfiling(){return this.IsDebug()&&b.IsCPUProfiling()}IsGPUProfiling(){return this.IsDebug()&&this.GetRenderer().SupportsGPUProfiling()&&b.IsGPUProfiling()}async DebugIterateAndBreak(c){if(c)for(const f of c)await this.DebugBreak(f)}DebugFireGeneratorEventAndBreak(c){return this.DebugIterateAndBreak(this._dispatcher.dispatchGeneratorEvent(c))}_InvokeFunctionFromJS(c){return this._eventSheetManager._InvokeFunctionFromJS(c.name,
c.params)}GetIRuntime(){return this._iRuntime}_CreateUserScriptEvent(c){c=e.New(e.Event,c,!1);c.runtime=this._iRuntime;return c}_InitScriptInterfaces(){var c={};for(const f of this._allObjectClasses)c[f.GetJsPropName()]={value:f.GetIObjectClass(),enumerable:!0,writable:!1};c=Object.create(Object.prototype,c);this._iRuntime=new self.IRuntime(this,c);this._userScriptEventObjects={tick:this._CreateUserScriptEvent("tick")}}_InitGlobalVariableScriptInterface(){const c={};for(const f of this.GetEventSheetManager().GetAllGlobalVariables())c[f.GetJsPropName()]=
f._GetScriptInterfaceDescriptor();this._iRuntime._InitGlobalVars(c)}_GetCommonScriptInterfaces(){return this._commonScriptInterfaces}_MapScriptInterface(c,f){this._interfaceMap.set(c,f)}_UnwrapScriptInterface(c){return this._interfaceMap.get(c)}_UnwrapIObjectClass(c){if(!(c instanceof self.IObjectClass))throw new TypeError("expected IObjectClass");c=this._UnwrapScriptInterface(c);if(!(c&&c instanceof e.ObjectClass))throw Error("invalid IObjectClass");return c}_UnwrapIWorldInstance(c){if(!(c instanceof
self.IWorldInstance))throw new TypeError("expected IWorldInstance");c=this._UnwrapScriptInterface(c);if(!(c&&c instanceof e.Instance))throw Error("invalid IInstance");return c}};self.C3_CreateRuntime=e.Runtime.Create;self.C3_InitRuntime=(c,f)=>c.Init(f)}
{"use strict";const e=self.C3;e.JobSchedulerRuntime=class extends e.DefendedBase{constructor(b,a){super();this._runtime=b;this._jobPromises=new Map;this._nextJobId=0;this._inputPort=a.inputPort;a.outputPort.onmessage=d=>this._OnJobWorkerMessage(d);this._maxNumWorkers=a.maxNumWorkers;this._jobWorkerCount=1;this._hadErrorCreatingWorker=this._isCreatingWorker=!1}async Init(){}ImportScriptsToJobWorkers(b){this._inputPort.postMessage({type:"_import_scripts",scripts:b})}SendBlobToJobWorkers(b,a){this._inputPort.postMessage({type:"_send_blob",
blob:b,id:a})}SendBufferToJobWorkers(b,a){this._inputPort.postMessage({type:"_send_buffer",buffer:b,id:a},[b])}AddJob(b,a,d,c,f){d||(d=[]);const h=this._nextJobId++;b={type:b,isBroadcast:!1,jobId:h,params:a,transferables:d};a=new Promise((g,l)=>{this._jobPromises.set(h,{resolve:g,progress:c,reject:l,cancelled:!1})});f&&f.SetAction(()=>this._CancelJob(h));this._inputPort.postMessage(b,d);this._MaybeCreateExtraWorker();return a}BroadcastJob(b,a,d){d||(d=[]);const c=this._nextJobId++;this._inputPort.postMessage({type:b,
isBroadcast:!0,jobId:c,params:a,transferables:d},d)}_CancelJob(b){const a=this._jobPromises.get(b);a&&(a.cancelled=!0,a.resolve=null,a.progress=null,a.reject=null,this._inputPort.postMessage({type:"_cancel",jobId:b}))}_OnJobWorkerMessage(b){b=b.data;const a=b.type,d=b.jobId;switch(a){case "result":this._OnJobResult(d,b.result);break;case "progress":this._OnJobProgress(d,b.progress);break;case "error":this._OnJobError(d,b.error);break;case "ready":this._OnJobWorkerReady();break;default:throw Error(`unknown message from worker '${a}'`);
}}_OnJobResult(b,a){const d=this._jobPromises.get(b);if(!d)throw Error("invalid job ID");d.cancelled||d.resolve(a);this._jobPromises.delete(b)}_OnJobProgress(b,a){b=this._jobPromises.get(b);if(!b)throw Error("invalid job ID");!b.cancelled&&b.progress&&b.progress(a)}_OnJobError(b,a){const d=this._jobPromises.get(b);if(!d)throw Error("invalid job ID");d.cancelled||d.reject(a);this._jobPromises.delete(b)}_OnJobWorkerReady(){this._isCreatingWorker&&(this._isCreatingWorker=!1,this._jobWorkerCount++,this._jobWorkerCount<
this._maxNumWorkers?this._MaybeCreateExtraWorker():this._inputPort.postMessage({type:"_no_more_workers"}))}async _MaybeCreateExtraWorker(){if(!(this._jobWorkerCount>=this._maxNumWorkers||this._isCreatingWorker||this._hadErrorCreatingWorker||this._jobPromises.size<=this._jobWorkerCount))try{this._isCreatingWorker=!0,(await this._runtime.PostComponentMessageToDOMAsync("runtime","create-job-worker")).outputPort.onmessage=b=>this._OnJobWorkerMessage(b)}catch(b){this._hadErrorCreatingWorker=!0,this._isCreatingWorker=
!1,console.error(`[Construct 3] Failed to create job worker; stopping creating any more (created ${this._jobWorkerCount} so far)`,b)}}}}self.C3_Shaders={};
{"use strict";const e=self.C3;let b=null,a="",d="",c=[],f="",h="",g="";const l=e.New(e.ArrayStack);function m(u,w){u=u[1];w=w[1];if("number"===typeof u&&"number"===typeof w)return u-w;u=""+u;w=""+w;return u<w?-1:u>w?1:0}e.Plugins.System=class extends e.SDKPluginBase{constructor(u){super(u);this._loopStack=this._runtime.GetEventSheetManager().GetLoopStack();this._eventStack=this._runtime.GetEventSheetManager().GetEventStack();this._imagesLoadingComplete=this._imagesLoadingTotal=0;this._functionMaps=
new Map}Release(){super.Release()}UpdateRender(){this._runtime.UpdateRender()}Trigger(u){this._runtime.Trigger(u,null,null)}GetRegex(u,w){b&&u===a&&w===d||(b=new RegExp(u,w),a=u,d=w);b.lastIndex=0;return b}GetRegexMatches(u,w,q){if(u===f&&w===h&&q===g)return c;const t=this.GetRegex(w,q);c=u.match(t);f=u;h=w;g=q;return c}async _LoadTexturesForObjectClasses(u,w){if(w.length){this._imagesLoadingTotal+=w.length;var q=[];for(const t of w)q.push(u.MaybeLoadTexturesFor(t));await e.PromiseAllWithProgress(q,
()=>{this._imagesLoadingComplete++});this._imagesLoadingComplete++;this._imagesLoadingComplete===this._imagesLoadingTotal&&(this._runtime.Trigger(e.Plugins.System.Cnds.OnImageLoadingComplete,null,null),this._imagesLoadingTotal=this._imagesLoadingComplete=0)}}_UnloadTexturesForObjectClasses(u,w){for(const q of w)0===q.GetInstanceCount()&&u.MaybeUnloadTexturesFor(q)}_GetForEachStack(){return l}_Repeat(u){var w=this._runtime.GetEventSheetManager();const q=w.GetEventStack(),t=q.GetCurrentStackFrame(),
p=t.GetCurrentEvent(),r=p.GetSolModifiers();var x=t.IsSolModifierAfterCnds();const y=q.Push(p),D=w.GetLoopStack(),G=D.Push();G.SetEnd(u);if(x)for(x=0;x<u&&!G.IsStopped();++x)w.PushCopySol(r),G.SetIndex(x),p.Retrigger(t,y),w.PopSol(r);else for(w=0;w<u&&!G.IsStopped();++w)G.SetIndex(w),p.Retrigger(t,y);q.Pop();D.Pop();return!1}*_DebugRepeat(u){var w=this._runtime.GetEventSheetManager();const q=w.GetEventStack(),t=q.GetCurrentStackFrame(),p=t.GetCurrentEvent(),r=p.GetSolModifiers();var x=t.IsSolModifierAfterCnds();
const y=q.Push(p),D=w.GetLoopStack(),G=D.Push();G.SetEnd(u);if(x)for(x=0;x<u&&!G.IsStopped();++x)w.PushCopySol(r),G.SetIndex(x),yield*p.DebugRetrigger(t,y),w.PopSol(r);else for(w=0;w<u&&!G.IsStopped();++w)G.SetIndex(w),yield*p.DebugRetrigger(t,y);q.Pop();D.Pop();return!1}_While(){var u=this._runtime.GetEventSheetManager();const w=u.GetEventStack(),q=w.GetCurrentStackFrame(),t=q.GetCurrentEvent(),p=t.GetSolModifiers();var r=q.IsSolModifierAfterCnds();const x=w.Push(t),y=u.GetLoopStack(),D=y.Push();
if(r)for(r=0;!D.IsStopped();++r)u.PushCopySol(p),D.SetIndex(r),t.Retrigger(q,x)||D.Stop(),u.PopSol(p);else for(u=0;!D.IsStopped();++u)D.SetIndex(u),t.Retrigger(q,x)||D.Stop();w.Pop();y.Pop();return!1}*_DebugWhile(){var u=this._runtime.GetEventSheetManager();const w=u.GetEventStack(),q=w.GetCurrentStackFrame(),t=q.GetCurrentEvent(),p=t.GetSolModifiers();var r=q.IsSolModifierAfterCnds();const x=w.Push(t),y=u.GetLoopStack(),D=y.Push();if(r)for(r=0;!D.IsStopped();++r)u.PushCopySol(p),D.SetIndex(r),(yield*t.DebugRetrigger(q,
x))||D.Stop(),u.PopSol(p);else for(u=0;!D.IsStopped();++u)D.SetIndex(u),(yield*t.DebugRetrigger(q,x))||D.Stop();w.Pop();y.Pop();return!1}_For(u,w,q){var t=this._runtime.GetEventSheetManager();const p=t.GetEventStack(),r=p.GetCurrentStackFrame(),x=r.GetCurrentEvent(),y=x.GetSolModifiers(),D=r.IsSolModifierAfterCnds(),G=p.Push(x),A=t.GetLoopStack(),F=A.Push();F.SetName(u);F.SetEnd(q);if(q<w)if(D)for(u=w;u>=q&&!F.IsStopped();--u)t.PushCopySol(y),F.SetIndex(u),x.Retrigger(r,G),t.PopSol(y);else for(t=
w;t>=q&&!F.IsStopped();--t)F.SetIndex(t),x.Retrigger(r,G);else if(D)for(u=w;u<=q&&!F.IsStopped();++u)t.PushCopySol(y),F.SetIndex(u),x.Retrigger(r,G),t.PopSol(y);else for(t=w;t<=q&&!F.IsStopped();++t)F.SetIndex(t),x.Retrigger(r,G);p.Pop();A.Pop();return!1}*_DebugFor(u,w,q){var t=this._runtime.GetEventSheetManager();const p=t.GetEventStack(),r=p.GetCurrentStackFrame(),x=r.GetCurrentEvent(),y=x.GetSolModifiers(),D=r.IsSolModifierAfterCnds(),G=p.Push(x),A=t.GetLoopStack(),F=A.Push();F.SetName(u);F.SetEnd(q);
if(q<w)if(D)for(u=w;u>=q&&!F.IsStopped();--u)t.PushCopySol(y),F.SetIndex(u),yield*x.DebugRetrigger(r,G),t.PopSol(y);else for(t=w;t>=q&&!F.IsStopped();--t)F.SetIndex(t),yield*x.DebugRetrigger(r,G);else if(D)for(u=w;u<=q&&!F.IsStopped();++u)t.PushCopySol(y),F.SetIndex(u),yield*x.DebugRetrigger(r,G),t.PopSol(y);else for(t=w;t<=q&&!F.IsStopped();++t)F.SetIndex(t),yield*x.DebugRetrigger(r,G);p.Pop();A.Pop();return!1}_ForEach(u){var w=this._runtime.GetEventSheetManager();const q=w.GetEventStack(),t=q.GetCurrentStackFrame(),
p=t.GetCurrentEvent(),r=p.GetSolModifiers();var x=t.IsSolModifierAfterCnds();const y=q.Push(p),D=w.GetLoopStack(),G=D.Push(),A=u.IsInContainer(),F=u.GetCurrentSol(),J=l.Push();e.shallowAssignArray(J,F.GetInstances());G.SetEnd(J.length);if(x)for(let B=0,I=J.length;B<I&&!G.IsStopped();++B)w.PushCopySol(r),x=J[B],u.GetCurrentSol().SetSinglePicked(x),A&&x.SetSiblingsSinglePicked(),G.SetIndex(B),p.Retrigger(t,y),w.PopSol(r);else{F._SetSelectAll(!1);u=F._GetOwnInstances();e.clearArray(u);u.push(null);for(let B=
0,I=J.length;B<I&&!G.IsStopped();++B)w=J[B],u[0]=w,A&&w.SetSiblingsSinglePicked(),G.SetIndex(B),p.Retrigger(t,y)}q.Pop();D.Pop();e.clearArray(J);l.Pop();return!1}*_DebugForEach(u){var w=this._runtime.GetEventSheetManager();const q=w.GetEventStack(),t=q.GetCurrentStackFrame(),p=t.GetCurrentEvent(),r=p.GetSolModifiers();var x=t.IsSolModifierAfterCnds();const y=q.Push(p),D=w.GetLoopStack(),G=D.Push(),A=u.IsInContainer(),F=u.GetCurrentSol(),J=l.Push();e.shallowAssignArray(J,F.GetInstances());G.SetEnd(J.length);
if(x)for(let B=0,I=J.length;B<I&&!G.IsStopped();++B)w.PushCopySol(r),x=J[B],u.GetCurrentSol().SetSinglePicked(x),A&&x.SetSiblingsSinglePicked(),G.SetIndex(B),yield*p.DebugRetrigger(t,y),w.PopSol(r);else{F._SetSelectAll(!1);u=F._GetOwnInstances();e.clearArray(u);u.push(null);for(let B=0,I=J.length;B<I&&!G.IsStopped();++B)w=J[B],u[0]=w,A&&w.SetSiblingsSinglePicked(),G.SetIndex(B),yield*p.DebugRetrigger(t,y)}q.Pop();D.Pop();e.clearArray(J);l.Pop();return!1}_ForEachOrdered(u,w){var q=this._runtime.GetEventSheetManager();
const t=q.GetEventStack(),p=q.GetCurrentCondition(),r=t.GetCurrentStackFrame(),x=r.GetCurrentEvent(),y=x.GetSolModifiers(),D=r.IsSolModifierAfterCnds(),G=t.Push(x),A=q.GetLoopStack(),F=A.Push(),J=u.IsInContainer(),B=u.GetCurrentSol(),I=l.Push();e.clearArray(I);const L=B.GetInstances();F.SetEnd(L.length);for(let Q=0,S=L.length;Q<S;++Q)I.push([L[Q],p.ReevaluateParameter(1,Q)]);I.sort(m);1===w&&I.reverse();if(D)for(let Q=0,S=I.length;Q<S&&!F.IsStopped();++Q)q.PushCopySol(y),w=I[Q][0],u.GetCurrentSol().SetSinglePicked(w),
J&&w.SetSiblingsSinglePicked(),F.SetIndex(Q),x.Retrigger(r,G),q.PopSol(y);else{B._SetSelectAll(!1);u=B._GetOwnInstances();e.clearArray(u);u.push(null);for(let Q=0,S=I.length;Q<S&&!F.IsStopped();++Q)q=I[Q][0],u[0]=q,J&&q.SetSiblingsSinglePicked(),F.SetIndex(Q),x.Retrigger(r,G)}t.Pop();A.Pop();e.clearArray(I);l.Pop();return!1}*_DebugForEachOrdered(u,w){var q=this._runtime.GetEventSheetManager();const t=q.GetEventStack(),p=q.GetCurrentCondition(),r=t.GetCurrentStackFrame(),x=r.GetCurrentEvent(),y=x.GetSolModifiers(),
D=r.IsSolModifierAfterCnds(),G=t.Push(x),A=q.GetLoopStack(),F=A.Push(),J=u.IsInContainer(),B=u.GetCurrentSol(),I=l.Push();e.clearArray(I);const L=B.GetInstances();F.SetEnd(L.length);for(let Q=0,S=L.length;Q<S;++Q)I.push([L[Q],p.ReevaluateParameter(1,Q)]);I.sort(m);1===w&&I.reverse();if(D)for(let Q=0,S=I.length;Q<S&&!F.IsStopped();++Q)q.PushCopySol(y),w=I[Q][0],u.GetCurrentSol().SetSinglePicked(w),J&&w.SetSiblingsSinglePicked(),F.SetIndex(Q),yield*x.DebugRetrigger(r,G),q.PopSol(y);else{B._SetSelectAll(!1);
u=B._GetOwnInstances();e.clearArray(u);u.push(null);for(let Q=0,S=I.length;Q<S&&!F.IsStopped();++Q)q=I[Q][0],u[0]=q,J&&q.SetSiblingsSinglePicked(),F.SetIndex(Q),yield*x.DebugRetrigger(r,G)}t.Pop();A.Pop();e.clearArray(I);l.Pop();return!1}_GetFunctionMap(u,w){let q=this._functionMaps.get(u);if(q)return q;if(!w)return null;q={defaultFunc:null,strMap:new Map};this._functionMaps.set(u,q);return q}_DoCallMappedFunction(u,w,q,t,p){w.GetEventBlock().RunAsMappedFunctionCall(q);t&&u.PopSol(p)}*_DebugDoCallMappedFunction(u,
w,q,t,p){yield*w.GetEventBlock().DebugRunAsMappedFunctionCall(q);t&&u.PopSol(p)}}}{"use strict";const e=self.C3;e.Plugins.System.Type=class extends e.DefendedBase{constructor(b){super();this._objectClass=b;this._runtime=b.GetRuntime();this._plugin=b.GetPlugin()}OnCreate(){}Release(){this._plugin=this._runtime=this._objectClass=null}}}
{"use strict";const e=self.C3;e.Plugins.System.Instance=class extends e.DefendedBase{constructor(b,a){super();this._inst=b;this._objectClass=this._inst.GetObjectClass();this._sdkType=this._objectClass.GetSdkType();this._runtime=this._inst.GetRuntime()}Release(){this._runtime=this._sdkType=this._objectClass=this._inst=null}}}
{"use strict";const e=self.C3,b=[];e.Plugins.System.Cnds={EveryTick(){return!0},OnLayoutStart(){return!0},OnLayoutEnd(){return!0},OnSuspend(){return!0},OnResume(){return!0},IsSuspended(){return this._runtime.IsSuspended()},Else(){const a=this._runtime.GetCurrentEventStackFrame();return a.GetElseBranchRan()?!1:!a.GetLastEventTrue()},TriggerOnce(){const a=this._runtime.GetCurrentCondition().GetSavedDataMap();let d=a.get("TriggerOnce_lastTick");"undefined"===typeof d&&(d=-1,a.set("TriggerOnce_lastTick",
-1));const c=this._runtime.GetTickCount();a.set("TriggerOnce_lastTick",c);return this._runtime.IsLayoutFirstTick()||d!==c-1},Every(a){const d=this._runtime.GetCurrentCondition().GetSavedDataMap(),c=d.get("Every_lastTime")||0,f=this._runtime.GetGameTime();d.has("Every_seconds")||d.set("Every_seconds",a);const h=d.get("Every_seconds");if(f>=c+h)return d.set("Every_lastTime",c+h),f>=d.get("Every_lastTime")+.04&&d.set("Every_lastTime",f),d.set("Every_seconds",a),!0;f<c-.1&&d.set("Every_lastTime",f);return!1},
IsGroupActive(a){return(a=this._runtime.GetEventSheetManager().GetEventGroupByName(a))&&a.IsGroupActive()},IsPreview(){return this._runtime.IsPreview()},IsMobile(){return e.Platform.IsMobile},OnLoadFinished(){return!0},OnCanvasSnapshot(){return!0},EffectsSupported(){return!0},OnSaveComplete(){return!0},OnSaveFailed(){return!0},OnLoadComplete(){return!0},OnLoadFailed(){return!0},ObjectUIDExists(a){return!!this._runtime.GetInstanceByUID(a)},IsOnPlatform(a){switch(a){case 0:return"browser"===e.Platform.Context;
case 1:return"iOS"===e.Platform.OS;case 2:return"Android"===e.Platform.OS;case 8:return"cordova"===e.Platform.Context;case 9:return"scirra-arcade"===this._runtime.GetExportType();case 10:return"nwjs"===e.Platform.Context;case 13:return"windows-uwp"===this._runtime.GetExportType();default:return!1}},RegexTest(a,d,c){return this.GetRegex(d,c).test(a)},Compare(a,d,c){return e.compare(a,d,c)},CompareBetween(a,d,c){return a>=d&&a<=c},CompareVar(a,d,c){return e.compare(a.GetValue(),d,c)},CompareBoolVar(a){return!!a.GetValue()},
CompareTime(a,d){const c=this._runtime.GetGameTime();return 0===a?(a=this._runtime.GetCurrentCondition().GetSavedDataMap(),!a.get("CompareTime_executed")&&c>=d?(a.set("CompareTime_executed",!0),!0):!1):e.compare(c,a,d)},IsNaN(a){return isNaN(a)},AngleWithin(a,d,c){return e.angleDiff(e.toRadians(a),e.toRadians(c))<=e.toRadians(d)},IsClockwiseFrom(a,d){return e.angleClockwise(e.toRadians(a),e.toRadians(d))},IsBetweenAngles(a,d,c){a=e.toRadians(a);d=e.toRadians(d);c=e.toRadians(c);return e.angleClockwise(c,
d)?e.angleClockwise(a,d)&&!e.angleClockwise(a,c):!(!e.angleClockwise(a,d)&&e.angleClockwise(a,c))},IsValueType(a,d){return"number"===typeof a?0===d:1===d},EvaluateExpression(a){return!!a},PickByComparison(a,d,c,f){if(!a)return!1;const h=this._GetForEachStack(),g=h.Push(),l=a.GetCurrentSol();e.shallowAssignArray(g,l.GetInstances());l.IsSelectAll()&&e.clearArray(l._GetOwnElseInstances());const m=this._runtime.GetCurrentCondition();let u=0;for(let w=0,q=g.length;w<q;++w){const t=g[w];g[u]=t;d=m.ReevaluateParameter(1,
w);f=m.ReevaluateParameter(3,w);e.compare(d,c,f)?++u:l._PushElseInstance(t)}e.truncateArray(g,u);l.SetArrayPicked(g);d=!!g.length;e.clearArray(g);h.Pop();a.ApplySolToContainer();return d},PickByEvaluate(a,d){if(!a)return!1;const c=this._GetForEachStack(),f=c.Push(),h=a.GetCurrentSol();e.shallowAssignArray(f,h.GetInstances());h.IsSelectAll()&&e.clearArray(h._GetOwnElseInstances());const g=this._runtime.GetCurrentCondition();let l=0;for(let m=0,u=f.length;m<u;++m){const w=f[m];f[l]=w;(d=g.ReevaluateParameter(1,
m))?++l:h._PushElseInstance(w)}e.truncateArray(f,l);h.SetArrayPicked(f);d=!!f.length;e.clearArray(f);c.Pop();a.ApplySolToContainer();return d},PickNth(a,d){if(!a)return!1;const c=a.GetCurrentSol(),f=c.GetInstances();d=Math.floor(d);if(d>=f.length)return!1;c.PickOne(f[d]);a.ApplySolToContainer();return!0},PickRandom(a){if(!a)return!1;const d=a.GetCurrentSol(),c=d.GetInstances(),f=Math.floor(this._runtime.Random()*c.length);if(f>=c.length)return!1;d.PickOne(c[f]);a.ApplySolToContainer();return!0},PickAll(a){if(!a||
!a.GetInstanceCount())return!1;a.GetCurrentSol()._SetSelectAll(!0);a.ApplySolToContainer();return!0},PickOverlappingPoint(a,d,c){if(!a)return!1;const f=a.GetCurrentSol();var h=f.GetInstances();const g=this._runtime.GetCurrentEvent().IsOrBlock(),l=this._runtime.GetCurrentCondition().IsInverted();f.IsSelectAll()?(e.shallowAssignArray(b,h),f.ClearArrays(),f._SetSelectAll(!1)):g?(e.shallowAssignArray(b,f._GetOwnElseInstances()),e.clearArray(f._GetOwnElseInstances())):(e.shallowAssignArray(b,f._GetOwnInstances()),
e.clearArray(f._GetOwnInstances()));for(let m=0,u=b.length;m<u;++m)h=b[m],e.xor(h.GetWorldInfo().ContainsPoint(d,c),l)?f._PushInstance(h):f._PushElseInstance(h);a.ApplySolToContainer();return e.xor(!!f._GetOwnInstances().length,l)},PickLastCreated(a){if(!a)return!1;var d=a.IsFamily();let c=null;const f=this._runtime._GetInstancesPendingCreate();for(let h=f.length-1;0<=h;--h){const g=f[h];if(d){if(g.GetObjectClass().BelongsToFamily(a)){c=g;break}}else if(g.GetObjectClass()===a){c=g;break}}c||(d=a.GetInstances(),
d.length&&(c=d.at(-1)));if(!c)return!1;a.GetCurrentSol().PickOne(c);a.ApplySolToContainer();return!0},Repeat(a){return this._runtime.IsDebugging()?this._DebugRepeat(a):this._Repeat(a)},While(){return this._runtime.IsDebugging()?this._DebugWhile():this._While()},For(a,d,c){return this._runtime.IsDebugging()?this._DebugFor(a,d,c):this._For(a,d,c)},ForEach(a){return this._runtime.IsDebugging()?this._DebugForEach(a):this._ForEach(a)},ForEachOrdered(a,d,c){return this._runtime.IsDebugging()?this._DebugForEachOrdered(a,
c):this._ForEachOrdered(a,c)},LayerVisible(a){return a?a.IsVisible():!1},LayerInteractive(a){return a?a.IsSelfAndParentsInteractive():!1},LayerEmpty(a){return a?!a.GetInstanceCount():!1},LayerCmpOpacity(a,d,c){return a?e.compare(100*a.GetOpacity(),d,c):!1},OnImageLoadingComplete(){return!0},IsLoadingImages(){return 0<this._imagesLoadingTotal}}}
{"use strict";const e=self.C3;function b(g,l){const m=g[0]-l[0];return 0!==m?m:g[1]-l[1]}function a(g,l){return g[1]-l[1]}const d=[],c=[],f=e.New(e.Rect),h=e.New(e.Color);e.Plugins.System.Acts={SetVar(g,l){g.SetValue(l)},AddVar(g,l){g.IsNumber()&&"number"!==typeof l&&(l=parseFloat(l));g.SetValue(g.GetValue()+l)},SubVar(g,l){g.IsNumber()&&g.SetValue(g.GetValue()-l)},SetBoolVar(g,l){g.SetValue(!!l)},ToggleBoolVar(g){g.SetValue(!g.GetValue())},ResetGlobals(){this._runtime.GetEventSheetManager().ResetAllGlobalsToInitialValue()},
CreateObject(g,l,m,u,w){g&&l&&(m=this._runtime.CreateInstance(g,l,m,u,w))&&(w&&l.SortAndAddInstancesByZIndex(m),l=this._runtime.GetEventSheetManager(),l.BlockFlushingInstances(!0),m._TriggerOnCreatedOnSelfAndRelated(),l.BlockFlushingInstances(!1),g.GetCurrentSol().SetSinglePicked(m),m.IsInContainer()&&m.SetSiblingsSinglePicked())},CreateObjectByName(g,l,m,u,w){g&&l&&(g=this._runtime.GetObjectClassByName(g))&&e.Plugins.System.Acts.CreateObject.call(this,g,l,m,u,w)},RecreateInitialObjects(g,l,m,u,w,
q,t,p,r,x){if(g){var y=this._runtime.GetCurrentLayout();if(q&&(y=this._runtime.GetLayoutManager().GetLayoutByName(q),!y))return;q=null;if("number"!==typeof t||0<=t)if(q=y.GetLayer(t),!q)return;f.set(l,m,u,w);l=y.RecreateInitialObjects(g,f,q,p,r,x);g.GetCurrentSol().SetArrayPicked(l);g.ApplySolToContainer()}},StopLoop(){const g=this._loopStack;g.IsInLoop()&&g.GetCurrent().Stop()},SetGroupActive(g,l){(g=this._runtime.GetEventSheetManager().GetEventGroupByName(g))&&(0===l?g.SetGroupActive(!1):1===l?
g.SetGroupActive(!0):g.SetGroupActive(!g.IsGroupActive()))},SetTimescale(g){this._runtime.SetTimeScale(g)},SetObjectTimescale(g,l){0>l&&(l=0);if(g){g=g.GetCurrentSol().GetInstances();for(const m of g)m.SetTimeScale(l)}},RestoreObjectTimescale(g){if(g){g=g.GetCurrentSol().GetInstances();for(const l of g)l.RestoreTimeScale()}},Wait(g){if(!(0>g))return this._runtime.GetEventSheetManager().AddScheduledWait().InitTimer(g),!0},WaitForSignal(g){this._runtime.GetEventSheetManager().AddScheduledWait().InitSignal(g);
return!0},WaitForPreviousActions(){const g=this._runtime.GetEventSheetManager();g.AddScheduledWait().InitPromise(g.GetPromiseForAllAsyncActions());return!0},Signal(g){g=g.toLowerCase();for(const l of this._runtime.GetEventSheetManager().scheduledWaits())l.IsSignal()&&l.GetSignalTag()===g&&l.SetSignalled()},async SnapshotCanvas(g,l,m,u,w,q){const t=this._runtime.GetCanvasManager();t&&(this.UpdateRender(),await t.SnapshotCanvas(0===g?"image/png":"image/jpeg",l/100,m,u,w,q),await this._runtime.TriggerAsync(e.Plugins.System.Cnds.OnCanvasSnapshot,
null))},SetCanvasSize(g,l){if(!(0>=g||0>=l)){this._runtime.SetViewportSize(g,l);var m=this._runtime.GetCurrentLayout();m.BoundScrolling();for(const u of m.GetLayers())u.UpdateViewport();if(m=this._runtime.GetCanvasManager())"off"!==m.GetCurrentFullscreenMode()&&this._runtime.SetOriginalViewportSize(g,l),m.SetSize(m.GetLastWidth(),m.GetLastHeight(),!0),this._runtime.UpdateRender()}},SetFullscreenQuality(g){const l=this._runtime.GetCanvasManager();l&&"off"!==l.GetCurrentFullscreenMode()&&(l.SetFullscreenScalingQuality(0!==
g?"high":"low"),l.SetSize(l.GetLastWidth(),l.GetLastHeight(),!0))},SaveState(g){this._runtime.SaveToSlot(g)},LoadState(g){this._runtime.LoadFromSlot(g)},LoadStateJSON(g){this._runtime.LoadFromJsonString(g)},SetHalfFramerateMode(g){},ResetPersisted(){for(const g of this._runtime.GetLayoutManager().GetAllLayouts())g.ResetPersistData()},SetPixelRounding(g){this._runtime.SetPixelRoundingEnabled(0!==g)},SetMinimumFramerate(g){this._runtime.SetMinimumFramerate(g)},SortZOrderByInstVar(g,l){if(g){var m=g.GetCurrentSol().GetInstances(),
u=this._runtime.GetCurrentLayout(),w=g.IsFamily();g=g.GetFamilyIndex();for(let t=0,p=m.length;t<p;++t){var q=m[t];const r=q.GetWorldInfo();if(!r)continue;let x;x=w?q.GetInstanceVariableValue(l+q.GetObjectClass().GetFamilyInstanceVariableOffset(g)):q.GetInstanceVariableValue(l);d.push([r.GetLayer().GetIndex(),r.GetZIndex()]);c.push([q,x])}if(d.length){d.sort(b);c.sort(a);l=!1;for(let t=0,p=d.length;t<p;++t)m=c[t][0],w=u.GetLayerByIndex(d[t][0]),g=d[t][1],q=w._GetInstances(),q[g]!==m&&(q[g]=m,m.GetWorldInfo()._SetLayer(w),
w.SetZIndicesChanged(),l=!0);l&&this._runtime.UpdateRender();e.clearArray(d);e.clearArray(c)}}},GoToLayout(g){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();l.IsPendingChangeMainLayout()||l.ChangeMainLayout(g)}},GoToLayoutByName(g){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();l.IsPendingChangeMainLayout()||(g=l.GetLayoutByName(g))&&l.ChangeMainLayout(g)}},NextPrevLayout(g){if(!this._runtime.IsLoading()){var l=this._runtime.GetLayoutManager();if(!l.IsPendingChangeMainLayout()){var m=
l.GetAllLayouts(),u=m.indexOf(l.GetMainRunningLayout());g&&0===u||(g||u!==m.length-1)&&l.ChangeMainLayout(m[u+(g?-1:1)])}}},RestartLayout(){if(!this._runtime.IsLoading()){var g=this._runtime.GetLayoutManager();g.IsPendingChangeMainLayout()||(g.ChangeMainLayout(g.GetMainRunningLayout()),this._runtime.GetEventSheetManager().ResetAllGroupsInitialActivation())}},SetLayerVisible(g,l){g&&g.SetVisible(l)},SetLayerInteractive(g,l){g&&g.SetInteractive(l)},SetLayerOpacity(g,l){g&&g.SetOpacity(l/100)},SetLayerScale(g,
l){g&&g.SetOwnScale(l)},SetLayerScaleRate(g,l){g&&g.SetScaleRate(l)},SetLayerAngle(g,l){g&&g.SetAngle(e.toRadians(+l))},SetLayerScroll(g,l,m){g&&(g.SetOwnScrollPositionEnabled(!0),g.SetScrollX(l),g.SetScrollY(m))},RestoreLayerScroll(g){g&&g.SetOwnScrollPositionEnabled(!1)},SetLayerParallax(g,l,m){g&&g.SetParallax(l/100,m/100)},SetLayerZElevation(g,l){g&&g.SetZElevation(+l)},SetLayerBackground(g,l){g&&(h.setFromRgbValue(l),h.clamp(),g=g.GetBackgroundColor(),g.equalsIgnoringAlpha(h)||(g.copyRgb(h),
this.UpdateRender()))},SetLayerTransparent(g,l){g&&g.SetTransparent(l)},SetLayerBlendMode(g,l){g&&g.SetBlendMode(l)},SetLayerEffectEnabled(g,l,m){g&&(m=g.GetEffectList().GetEffectTypeByName(m))&&(l=1===l,m.IsActive()!==l&&(m.SetActive(l),g.UpdateActiveEffects(),this._runtime.UpdateRender()))},SetLayerEffectParam(g,l,m,u){if(g&&(g=g.GetEffectList(),l=g.GetEffectTypeByName(l))){var w=l.GetIndex();g=g.GetEffectParametersForIndex(w);m=Math.floor(m);if(!(0>m||m>=g.length)){w=l.GetShaderProgram().GetParameterType(m);
if("color"===w){h.setFromRgbValue(u);m=g[m];if(h.equalsIgnoringAlpha(m))return;m.copyRgb(h)}else{"percent"===w&&(u/=100);if(g[m]===u)return;g[m]=u}l.IsActive()&&this._runtime.UpdateRender()}}},SetLayerForceOwnTexture(g,l){g&&g.SetForceOwnTexture(l)},SetLayoutScale(g){this._runtime.GetCurrentLayout().SetScale(+g)},SetLayoutAngle(g){this._runtime.GetCurrentLayout().SetAngle(e.toRadians(+g))},SetLayoutEffectEnabled(g,l){const m=this._runtime.GetCurrentLayout();if(l=m.GetEffectList().GetEffectTypeByName(l))g=
1===g,l.IsActive()!==g&&(l.SetActive(g),m.UpdateActiveEffects(),this._runtime.UpdateRender())},SetLayoutEffectParam(g,l,m){var u=this._runtime.GetCurrentLayout().GetEffectList();if(g=u.GetEffectTypeByName(g)){var w=g.GetIndex();u=u.GetEffectParametersForIndex(w);l=Math.floor(l);if(!(0>l||l>=u.length)){w=g.GetShaderProgram().GetParameterType(l);if("color"===w){h.setFromRgbValue(m);l=u[l];if(h.equalsIgnoringAlpha(l))return;l.copyRgb(h)}else{"percent"===w&&(m/=100);if(u[l]===m)return;u[l]=m}g.IsActive()&&
this._runtime.UpdateRender()}}},SetLayoutVanishingPoint(g,l){this._runtime.GetCurrentLayout().SetVanishingPointXY(g/100,l/100)},SetLayoutProjection(g){const l=this._runtime.GetCurrentLayout();0===g?l.SetPerspectiveProjection():l.SetOrthographicProjection()},ScrollX(g){this._runtime.GetCurrentLayout().SetScrollX(g)},ScrollY(g){this._runtime.GetCurrentLayout().SetScrollY(g)},Scroll(g,l){const m=this._runtime.GetCurrentLayout();m.SetScrollX(g);m.SetScrollY(l)},ScrollToObject(g){if(g&&(g=g.GetFirstPicked())&&
(g=g.GetWorldInfo())){var l=this._runtime.GetCurrentLayout();l.SetScrollX(g.GetX());l.SetScrollY(g.GetY())}},async LoadObjectTextures(g){const l=this._runtime.GetMainRunningLayout();l&&g&&!this._runtime.IsLoading()&&(g=g.IsFamily()?g.GetFamilyMembers():[g],await this._LoadTexturesForObjectClasses(l,g))},async LoadObjectTexturesByName(g){await e.Plugins.System.Acts.LoadObjectTextures.call(this,this._runtime.GetObjectClassByName(g))},UnloadObjectTextures(g){const l=this._runtime.GetMainRunningLayout();
l&&g&&(g=g.IsFamily()?g.GetFamilyMembers():[g],this._UnloadTexturesForObjectClasses(l,g))},UnloadObjectTexturesByName(g){e.Plugins.System.Acts.UnloadObjectTextures.call(this,this._runtime.GetObjectClassByName(g))},UnloadUnusedTextures(){const g=this._runtime.GetMainRunningLayout();if(g){var l=g._GetTextureLoadedObjectTypes();this._UnloadTexturesForObjectClasses(g,l)}},async LoadLayoutTextures(g){const l=this._runtime.GetMainRunningLayout();g&&l&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(l,
g._GetInitialObjectClasses())},async LoadLayoutTexturesByName(g){const l=this._runtime.GetMainRunningLayout();(g=this._runtime.GetLayoutManager().GetLayoutByName(g))&&l&&!this._runtime.IsLoading()&&await this._LoadTexturesForObjectClasses(l,g._GetInitialObjectClasses())},SetFunctionReturnValue(g){const l=this._eventStack.GetCurrentExpFuncStackFrame();if(l)switch(l.GetFunctionReturnType()){case 1:"number"===typeof g&&l.SetFunctionReturnValue(g);break;case 2:"string"===typeof g&&l.SetFunctionReturnValue(g);
break;case 3:l.SetFunctionReturnValue(g)}},MapFunction(g,l,m){var u=this._GetFunctionMap(g.toLowerCase(),!0);const w=u.strMap,q=l.toLowerCase();w.has(q)&&console.warn(`[Construct 3] Function map '${g}' string '${l}' already in map; overwriting entry`);if(u=e.first(w.values())||u.defaultFunc){u=0!==u.GetReturnType();const t=0!==m.GetReturnType();if(u!==t){console.error(`[Construct 3] Function map '${g}' string '${l}' function return type not compatible with other functions in the map; entry ignored`);
return}}w.set(q,m)},MapFunctionDefault(g,l){const m=this._GetFunctionMap(g.toLowerCase(),!0);m.defaultFunc&&console.warn(`[Construct 3] Function map '${g}' already has a default; overwriting entry`);var u=e.first(m.strMap.values())||m.defaultFunc;if(u){u=0!==u.GetReturnType();const w=0!==l.GetReturnType();if(u!==w){console.error(`[Construct 3] Function map '${g}' default: function return type not compatible with other functions in the map; entry ignored`);return}}m.defaultFunc=l},CallMappedFunction(g,
l,m){m=Math.floor(m);var u=this._GetFunctionMap(g.toLowerCase(),!1);if(u){var w=u.strMap.get(l.toLowerCase());if(!w)if(u.defaultFunc)w=u.defaultFunc,m=0;else{console.warn(`[Construct 3] Call mapped function: no function associated with map '${g}' string '${l}'; call ignored (consider setting a default)`);return}if(w.IsEnabled())if(0!==w.GetReturnType())console.warn(`[Construct 3] Call mapped function: map '${g}' string '${l}' has a return type so cannot be called`);else{g=this._runtime;l=g.GetEventSheetManager();
var q=l.GetCurrentEvent();u=q.GetSolModifiersIncludingParents();var t=0<u.length;t&&l.PushCleanSol(u);var p=[];if(q=l.FindFirstFunctionBlockParent(q)){q=q.GetFunctionParameters();for(let r=m,x=q.length;r<x;++r)p.push(q[r].GetValue())}m=w.GetFunctionParameters();for(let r=p.length,x=m.length;r<x;++r)p.push(m[r].GetInitialValue());return g.IsDebugging()?this._DebugDoCallMappedFunction(l,w,p,t,u):this._DoCallMappedFunction(l,w,p,t,u)}}else console.warn(`[Construct 3] Call mapped function: map name '${g}' not found; call ignored`)}}}
{"use strict";const e=self.C3;e.Plugins.System.Exps={int:function(b){"string"===typeof b&&(b=parseInt(b,10),isNaN(b)&&(b=0));return Math.floor(b)},float:function(b){"string"===typeof b&&(b=parseFloat(b),isNaN(b)&&(b=0));return b},str(b){return b.toString()},len(b){return"string"===typeof b?b.length:0},random(b,a){return"undefined"===typeof a?this._runtime.Random()*b:this._runtime.Random()*(a-b)+b},choose(...b){const a=Math.floor(this._runtime.Random()*b.length);return b[a]},pi(){return Math.PI},infinity(){return Infinity},
sqrt(b){return Math.sqrt(b)},abs(b){return Math.abs(b)},round(b){return Math.round(b)},roundtodp(b,a){a=Math.max(Math.floor(a),0);a=Math.pow(10,a);return Math.round((b+Number.EPSILON)*a)/a},floor(b){return Math.floor(b)},ceil(b){return Math.ceil(b)},sign(b){return Math.sign(b)},sin(b){return Math.sin(e.toRadians(b))},cos(b){return Math.cos(e.toRadians(b))},tan(b){return Math.tan(e.toRadians(b))},asin(b){return e.toDegrees(Math.asin(b))},acos(b){return e.toDegrees(Math.acos(b))},atan(b){return e.toDegrees(Math.atan(b))},
exp(b){return Math.exp(b)},ln(b){return Math.log(b)},log10(b){return Math.log(b)/Math.LN10},max(...b){let a=b[0];"number"!==typeof a&&(a=0);for(let d=1,c=b.length;d<c;++d){let f=b[d];"number"===typeof f&&a<f&&(a=f)}return a},min(...b){let a=b[0];"number"!==typeof a&&(a=0);for(let d=1,c=b.length;d<c;++d){let f=b[d];"number"===typeof f&&a>f&&(a=f)}return a},clamp(b,a,d){return e.clamp(b,a,d)},distance(b,a,d,c){return e.distanceTo(b,a,d,c)},angle(b,a,d,c){return e.toDegrees(e.angleTo(b,a,d,c))},lerp(b,
a,d){return e.lerp(b,a,d)},unlerp(b,a,d){return e.unlerp(b,a,d)},qarp(b,a,d,c){return e.qarp(b,a,d,c)},cubic(b,a,d,c,f){return e.cubic(b,a,d,c,f)},cosp(b,a,d){return e.cosp(b,a,d)},anglediff(b,a){return e.toDegrees(e.angleDiff(e.toRadians(b),e.toRadians(a)))},anglelerp(b,a,d){return e.toDegrees(e.angleLerp(e.toRadians(b),e.toRadians(a),d))},anglerotate(b,a,d){return e.toDegrees(e.angleRotate(e.toRadians(b),e.toRadians(a),e.toRadians(d)))},setbit(b,a,d){a|=0;return(b|0)&~(1<<a)|(0!==d?1:0)<<a},togglebit(b,
a){return(b|0)^1<<(a|0)},getbit(b,a){return(b|0)&1<<(a|0)?1:0},newline(){return"\n"},uppercase(b){return"string"===typeof b?b.toUpperCase():""},lowercase(b){return"string"===typeof b?b.toLowerCase():""},left(b,a){return"string"===typeof b?b.substr(0,a):""},mid(b,a,d){return"string"!==typeof b?"":0>d?b.substr(a):b.substr(a,d)},right(b,a){return"string"===typeof b?b.substr(Math.max(b.length-a,0)):""},trim(b){return"string"===typeof b?b.trim():""},tokenat(b,a,d){if("string"!==typeof b||"string"!==typeof d)return"";
b=b.split(d);a=Math.floor(a);return 0>a||a>=b.length?"":b[a]},tokencount(b,a){return"string"===typeof b&&"string"===typeof a&&b.length?b.split(a).length:0},find(b,a){return"string"===typeof b&&"string"===typeof a?b.search(new RegExp(e.EscapeRegex(a),"i")):-1},findcase(b,a){return"string"===typeof b&&"string"===typeof a?b.search(new RegExp(e.EscapeRegex(a),"")):-1},replace(b,a,d){return"string"===typeof b&&"string"===typeof a&&"string"===typeof d?b.replace(new RegExp(e.EscapeRegex(a),"gi"),d):"string"===
typeof b?b:""},regexsearch(b,a,d){a=this.GetRegex(a,d);return b?b.search(a):-1},regexreplace(b,a,d,c){a=this.GetRegex(a,d);return b?b.replace(a,c):""},regexmatchcount(b,a,d){return(b=this.GetRegexMatches(b.toString(),a,d))?b.length:0},regexmatchat(b,a,d,c){c=Math.floor(c);b=this.GetRegexMatches(b.toString(),a,d);return!b||0>c||c>=b.length?"":b[c]},zeropad(b,a){let d=0>b?"-":"";0>b&&(b=-b);d+="0".repeat(Math.max(a-b.toString().length,0));return d+b.toString()},urlencode(b){return encodeURIComponent(b)},
urldecode(b){return decodeURIComponent(b)},dt(){return this._runtime._GetDtFast()},timescale(){return this._runtime.GetTimeScale()},wallclocktime(){return(Date.now()-this._runtime.GetStartTime())/1E3},unixtime(){return Date.now()},time(){return this._runtime.GetGameTime()},tickcount(){return this._runtime.GetTickCount()},objectcount(){return this._runtime.GetObjectCount()},fps(){return this._runtime.GetFPS()},cpuutilisation(){return this._runtime.GetMainThreadTime()},gpuutilisation(){return this._runtime.GetGPUUtilisation()},
windowwidth(){return this._runtime.GetCanvasManager().GetDeviceWidth()},windowheight(){return this._runtime.GetCanvasManager().GetDeviceHeight()},originalwindowwidth(){return this._runtime.GetOriginalViewportWidth()},originalwindowheight(){return this._runtime.GetOriginalViewportHeight()},originalviewportwidth(){return this._runtime.GetOriginalViewportWidth()},originalviewportheight(){return this._runtime.GetOriginalViewportHeight()},scrollx(){return this._runtime.GetCurrentLayout().GetScrollX()},
scrolly(){return this._runtime.GetCurrentLayout().GetScrollY()},layoutname(){return this._runtime.GetCurrentLayout().GetName()},layoutscale(){return this._runtime.GetCurrentLayout().GetScale()},layoutangle(){return e.toDegrees(this._runtime.GetCurrentLayout().GetAngle())},layoutwidth(){return this._runtime.GetCurrentLayout().GetWidth()},layoutheight(){return this._runtime.GetCurrentLayout().GetHeight()},viewportleft(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getLeft():
0},viewporttop(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getTop():0},viewportright(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getRight():0},viewportbottom(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().getBottom():0},viewportwidth(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().width():0},viewportheight(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetViewport3D().height():
0},canvastolayerx(b,a,d){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,d)[0]:0},canvastolayery(b,a,d){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.CanvasCssToLayer(a,d)[1]:0},layertocanvasx(b,a,d){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,d)[0]:0},layertocanvasy(b,a,d){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.LayerToCanvasCss(a,d)[1]:0},layerscale(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetOwnScale():
0},layerangle(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?e.toDegrees(b.GetOwnAngle()):0},layeropacity(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?100*b.GetOpacity():0},layerscalerate(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetScaleRate():0},layerscrollx(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetScrollX():0},layerscrolly(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetScrollY():0},layerparallaxx(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?
100*b.GetParallaxX():0},layerparallaxy(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?100*b.GetParallaxY():0},layerzelevation(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetZElevation():0},layerindex(b){return(b=this._runtime.GetCurrentLayout().GetLayer(b))?b.GetIndex():-1},canvassnapshot(){const b=this._runtime.GetCanvasManager();return b?b.GetCanvasSnapshotUrl():""},loopindex(b){const a=this._loopStack;return a.IsInLoop()?b?(b=a.FindByName(b))?b.GetIndex():0:a.GetCurrent().GetIndex():
0},savestatejson(){return this._runtime.GetLastSaveJsonString()},callmapped(b,a,...d){var c=this._GetFunctionMap(b.toLowerCase(),!1);if(!c)return console.warn(`[Construct 3] Call mapped function: map name '${b}' not found; returning 0`),0;var f=c.strMap.get(a.toLowerCase());if(!f)if(c.defaultFunc)f=c.defaultFunc;else return console.warn(`[Construct 3] Call mapped function: no function associated with map '${b}' string '${a}'; returning 0 (consider setting a default)`),0;c=f.GetReturnType();const h=
f.GetDefaultReturnValue();if(0===c)return console.warn(`[Construct 3] Call mapped function: map '${b}' string '${a}' has no return type so cannot be called from an expression; returning 0`),0;if(!f.IsEnabled())return h;b=this._runtime.GetEventSheetManager();a=b.GetCurrentEvent().GetSolModifiersIncludingParents();const g=0<a.length;g&&b.PushCleanSol(a);const l=f.GetFunctionParameters();for(let m=d.length,u=l.length;m<u;++m)d.push(l[m].GetInitialValue());f=f.GetEventBlock();d=f.RunAsExpressionFunctionCall(f.GetSolModifiersIncludingParents(),
c,h,...d);g&&b.PopSol(a);return d},loadingprogress(){return this._runtime.GetAssetManager().GetLoadProgress()},imageloadingprogress(){return 0===this._imagesLoadingTotal?1:this._imagesLoadingComplete/this._imagesLoadingTotal},renderer(){return this._runtime.GetWebGPURenderer()?"webgpu":"webgl"},rendererdetail(){return this._runtime.GetWebGPURenderer()?"<unavailable>":this._runtime.GetWebGLRenderer().GetUnmaskedRenderer()},imagememoryusage(){let b=this._runtime.GetRenderer().GetEstimatedTextureMemoryUsage();
return Math.round(100*b/1048576)/100},rgb(b,a,d){return e.PackRGB(b,a,d)},rgbex(b,a,d){return e.PackRGBEx(b/100,a/100,d/100)},rgba(b,a,d,c){return e.PackRGBAEx(b/100,a/100,d/100,c/100)},rgbex255(b,a,d){return e.PackRGBEx(b/255,a/255,d/255)},rgba255(b,a,d,c){return e.PackRGBAEx(b/255,a/255,d/255,c/255)},projectname(){return this._runtime.GetProjectName()},projectversion(){return this._runtime.GetProjectVersion()},currenteventsheetname(){return this._runtime.GetCurrentEvent().GetEventSheet().GetName()},
currenteventnumber(){return this._runtime.GetCurrentEvent().GetDisplayNumber()}}}{"use strict";const e=self.C3;e.Plugins.Sprite=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Plugins.Sprite.Type=class extends e.SDKTypeBase{constructor(b){super(b);this._animations=b.GetAnimations()}Release(){e.clearArray(this._animations);super.Release()}OnCreate(){for(const b of this._animations)b.LoadAllAssets(this._runtime)}LoadTextures(b){const a={sampling:this._runtime.GetSampling()};return Promise.all(this._animations.map(d=>d.LoadAllTextures(b,a)))}ReleaseTextures(){for(const b of this._animations)b.ReleaseAllTextures()}OnDynamicTextureLoadComplete(){this._UpdateAllCurrentTexture()}_UpdateAllCurrentTexture(){for(const b of this._objectClass.instancesIncludingPendingCreate())b.GetSdkInstance()._UpdateCurrentTexture()}FinishCondition(b){e.Plugins.Sprite.FinishCollisionCondition(this,
b)}}}
{"use strict";const e=self.C3,b=self.C3X,a=e.New(e.Rect),d=e.New(e.Quad),c=e.New(e.Vector2);e.Plugins.Sprite.Instance=class extends e.SDKWorldInstanceBase{constructor(g,l){super(g);let m=!0,u="",w=0,q=!0;l&&(m=!!l[0],u=l[1],w=l[2],q=l[3]);this._currentAnimation=this._objectClass.GetAnimationByName(u)||this._objectClass.GetAnimations()[0];this._currentFrameIndex=e.clamp(w,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationFrame=this._currentAnimation.GetFrameAt(this._currentFrameIndex);l=
this._currentAnimationFrame.GetImageInfo();this._currentTexture=l.GetTexture();this._currentRcTex=l.GetTexRect();this._currentQuadTex=l.GetTexQuad();this.HandleWebGLContextLoss();g.SetFlag(2,!0);g.SetFlag(1,0<=this._currentAnimation.GetSpeed());this._currentAnimationSpeed=Math.abs(this._currentAnimation.GetSpeed());this._currentAnimationRepeatTo=this._currentAnimation.GetRepeatTo();this._animationTimer=e.New(e.KahanSum);this._animationRepeats=this._frameStartTime=0;this._animTriggerName="";this._changeAnimFrameIndex=
-1;this._changeAnimationName="";this._changeAnimationFrom=0;g=this.GetWorldInfo();this._bquadRef=g.GetBoundingQuad();g.SetVisible(m);g.SetCollisionEnabled(q);g.SetOriginX(this._currentAnimationFrame.GetOriginX());g.SetOriginY(this._currentAnimationFrame.GetOriginY());g.SetSourceCollisionPoly(this._currentAnimationFrame.GetCollisionPoly());g.SetBboxChanged();1===this._objectClass.GetAnimationCount()&&1===this._objectClass.GetAnimations()[0].GetFrameCount()||0===this._currentAnimationSpeed||this._StartTicking()}Release(){this._animationTimer=
this._currentTexture=this._currentAnimationFrame=this._currentAnimation=null;super.Release()}GetCurrentImageInfo(){return this._currentAnimationFrame.GetImageInfo()}IsOriginalSizeKnown(){return!0}OnWebGLContextLost(){this._currentTexture=null}OnWebGLContextRestored(){this._UpdateCurrentTexture()}Draw(g){var l=this._currentTexture;null!==l&&(g.SetTexture(l),l=this.GetWorldInfo(),l.HasMesh()?this._DrawMesh(l,g):this._DrawStandard(l,g))}_DrawStandard(g,l){let m=this._bquadRef;this._runtime.IsPixelRoundingEnabled()&&
(m=g.PixelRoundQuad(m));l.Quad4(m,this._currentQuadTex)}_DrawMesh(g,l){const m=g.GetTransformedMesh();if(g.IsMeshChanged()){g.CalculateBbox(a,d,!1);let u=d;this._runtime.IsPixelRoundingEnabled()&&(u=g.PixelRoundQuad(u));m.CalculateTransformedMesh(g.GetSourceMesh(),u,this._currentQuadTex);g.SetMeshChanged(!1)}m.Draw(l)}GetAnimationTime(){return this._animationTimer.Get()}IsAnimationPlaying(){return this._inst.GetFlag(2)}SetAnimationPlaying(g){this._inst.SetFlag(2,g)}IsPlayingForwards(){return this._inst.GetFlag(1)}SetPlayingForwards(g){this._inst.SetFlag(1,
g)}IsInAnimationTrigger(){return this._inst.GetFlag(4)}SetInAnimationTrigger(g){this._inst.SetFlag(4,g)}Tick(){this._changeAnimationName&&this._DoChangeAnimation();0<=this._changeAnimFrameIndex&&this._DoChangeAnimFrame();const g=this._currentAnimationSpeed;if(this.IsAnimationPlaying()&&0!==g){var l=this._runtime.GetDt(this._inst);this._animationTimer.Add(l);l=this.GetAnimationTime();var m=this._currentAnimationFrame,u=m.GetDuration()/g;if(!(l<this._frameStartTime+u)){var w=this._currentAnimation,
q=this._currentAnimationRepeatTo,t=w.GetFrameCount(),p=w.GetRepeatCount(),r=w.IsLooping(),x=w.IsPingPong();this.IsPlayingForwards()?this._currentFrameIndex++:this._currentFrameIndex--;this._frameStartTime+=u;this._currentFrameIndex>=t&&(x?(this.SetPlayingForwards(!1),this._currentFrameIndex=t-2):r?this._currentFrameIndex=q:(this._animationRepeats++,this._animationRepeats>=p?this._FinishAnimation(!1):this._currentFrameIndex=q));0>this._currentFrameIndex&&(x?(this._currentFrameIndex=1,this.SetPlayingForwards(!0),
r||(this._animationRepeats++,this._animationRepeats>=p&&this._FinishAnimation(!0))):r?this._currentFrameIndex=q:(this._animationRepeats++,this._animationRepeats>=p?this._FinishAnimation(!0):this._currentFrameIndex=q));this._currentFrameIndex=e.clamp(this._currentFrameIndex,0,t-1);u=w.GetFrameAt(this._currentFrameIndex);l>this._frameStartTime+u.GetDuration()/g&&(this._frameStartTime=l);this._OnFrameChanged(m,u)}}else this._StopTicking()}_FinishAnimation(g){this._currentFrameIndex=g?0:this._currentAnimation.GetFrameCount()-
1;this.SetAnimationPlaying(!1);this._animTriggerName=this._currentAnimation.GetName();this.SetInAnimationTrigger(!0);this.DispatchScriptEvent("animationend",!1,{animationName:this._animTriggerName});this.Trigger(e.Plugins.Sprite.Cnds.OnAnyAnimFinished);this.Trigger(e.Plugins.Sprite.Cnds.OnAnimFinished);this.SetInAnimationTrigger(!1);this._animationRepeats=0}_OnFrameChanged(g,l){if(g!==l){var m=this.GetWorldInfo(),u=g.GetImageInfo(),w=l.GetImageInfo(),q=u.GetWidth();u=u.GetHeight();var t=w.GetWidth(),
p=w.GetHeight();q!==t&&m.SetWidth(m.GetWidth()*(t/q));u!==p&&m.SetHeight(m.GetHeight()*(p/u));m.SetOriginX(l.GetOriginX());m.SetOriginY(l.GetOriginY());m.SetSourceCollisionPoly(l.GetCollisionPoly());m.SetBboxChanged();this._currentAnimationFrame=l;this._currentTexture=w.GetTexture();this._currentRcTex=w.GetTexRect();this._currentQuadTex=w.GetTexQuad();m=this.GetInstance().GetBehaviorInstances();for(let r=0,x=m.length;r<x;++r)m[r].OnSpriteFrameChanged(g,l);this.DispatchScriptEvent("framechange",!1,
{animationName:this._currentAnimation.GetName(),animationFrame:this._currentFrameIndex});this.Trigger(e.Plugins.Sprite.Cnds.OnFrameChanged);this._runtime.UpdateRender()}}_StartAnim(g){this.SetAnimationPlaying(!0);this._frameStartTime=this.GetAnimationTime();1===g&&0!==this._currentFrameIndex&&(this._changeAnimFrameIndex=0,this.IsInAnimationTrigger()||this._DoChangeAnimFrame());this._StartTicking()}_SetAnim(g,l){this._changeAnimationName=g;this._changeAnimationFrom=l;this._StartTicking();this.IsInAnimationTrigger()||
this._DoChangeAnimation()}_GetCurrentAnimation(){return this._currentAnimation}_GetCurrentAnimationName(){return this._changeAnimationName?this._changeAnimationName:this._currentAnimation.GetName()}_SetAnimFrame(g){isFinite(g)&&(this._changeAnimFrameIndex=g,this.IsInAnimationTrigger()||this._DoChangeAnimFrame())}_GetAnimFrame(){return this._currentFrameIndex}_SetAnimSpeed(g){this._currentAnimationSpeed=Math.abs(g);this.SetPlayingForwards(0<=g);0<this._currentAnimationSpeed&&this._StartTicking()}_GetAnimSpeed(){return this.IsPlayingForwards()?
this._currentAnimationSpeed:-this._currentAnimationSpeed}_SetAnimRepeatToFrame(g){this._currentAnimationRepeatTo=g=e.clamp(Math.floor(g),0,this._currentAnimation.GetFrameCount()-1)}_GetAnimRepeatToFrame(){return this._currentAnimationRepeatTo}_DoChangeAnimation(){const g=this._currentAnimationFrame;var l=this._objectClass.GetAnimationByName(this._changeAnimationName);this._changeAnimationName="";!l||l===this._currentAnimation&&this.IsAnimationPlaying()||(this._currentAnimation=l,this.SetPlayingForwards(0<=
l.GetSpeed()),this._currentAnimationSpeed=Math.abs(l.GetSpeed()),this._currentAnimationRepeatTo=l.GetRepeatTo(),this._currentFrameIndex=e.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1),1===this._changeAnimationFrom&&(this._currentFrameIndex=0),this.SetAnimationPlaying(!0),this._frameStartTime=this.GetAnimationTime(),l=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(g,l))}_DoChangeAnimFrame(){const g=this._currentAnimationFrame;var l=this._currentFrameIndex;
this._currentFrameIndex=e.clamp(Math.floor(this._changeAnimFrameIndex),0,this._currentAnimation.GetFrameCount()-1);this._changeAnimFrameIndex=-1;l!==this._currentFrameIndex&&(l=this._currentAnimation.GetFrameAt(this._currentFrameIndex),this._OnFrameChanged(g,l),this._frameStartTime=this.GetAnimationTime())}_UpdateCurrentTexture(){const g=this._currentAnimationFrame.GetImageInfo();this._currentTexture=g.GetTexture();this._currentRcTex=g.GetTexRect();this._currentQuadTex=g.GetTexQuad();this.GetWorldInfo().SetMeshChanged(!0)}GetTexture(){return this._currentTexture}GetTexRect(){return this._currentRcTex}GetTexQuad(){return this._currentQuadTex}GetImagePointCount(){return this._currentAnimationFrame.GetImagePointCount()}GetImagePoint(g){const l=
this._currentAnimationFrame,m=this.GetWorldInfo();if("string"===typeof g)g=l.GetImagePointByName(g);else if("number"===typeof g)g=l.GetImagePointByIndex(g-1);else throw new TypeError("expected string or number");if(!g)return[m.GetX(),m.GetY()];c.copy(g.GetVec2());if(m.HasMesh()){const [u,w]=m.GetSourceMesh().TransformPoint(c.getX(),c.getY());c.set(u,w)}c.offset(-l.GetOriginX(),-l.GetOriginY());c.scale(m.GetWidth(),m.GetHeight());c.rotate(m.GetAngle());c.offset(m.GetX(),m.GetY());return[c.getX(),c.getY()]}GetCollisionPolyPointCount(){return this.GetWorldInfo().GetTransformedCollisionPoly().pointCount()}GetCollisionPolyPoint(g){g=
Math.floor(g);const l=this.GetWorldInfo();var m=l.GetTransformedCollisionPoly();const u=m.pointCount();g===u&&(g=0);if(0>g||g>=u)return[0,0];m=m.pointsArr();return[m[2*g]+l.GetX(),m[2*g+1]+l.GetY()]}GetDebuggerProperties(){const g=e.Plugins.Sprite.Acts;return[{title:"plugins.sprite.debugger.animation-properties.title",properties:[{name:"plugins.sprite.debugger.animation-properties.current-animation",value:this._currentAnimation.GetName(),onedit:l=>this.CallAction(g.SetAnim,l,0)},{name:"plugins.sprite.debugger.animation-properties.current-frame",
value:this._currentFrameIndex,onedit:l=>this.CallAction(g.SetAnimFrame,l)},{name:"plugins.sprite.debugger.animation-properties.is-playing",value:this.IsAnimationPlaying(),onedit:l=>l?this.CallAction(g.StartAnim,0):this.CallAction(g.StopAnim)},{name:"plugins.sprite.debugger.animation-properties.speed",value:this._currentAnimationSpeed,onedit:l=>this.CallAction(g.SetAnimSpeed,l)},{name:"plugins.sprite.debugger.animation-properties.repeats",value:this._animationRepeats,onedit:l=>this._animationRepeats=
l}]}]}SaveToJson(){const g={a:this._currentAnimation.GetSID()};0!==this._frameStartTime&&(g.fs=this._frameStartTime);var l=this.GetAnimationTime();0!==l&&(g.at=l);0!==this._currentFrameIndex&&(g.f=this._currentFrameIndex);0!==this._currentAnimationSpeed&&(g.cas=this._currentAnimationSpeed);1!==this._animationRepeats&&(g.ar=this._animationRepeats);0!==this._currentAnimationRepeatTo&&(g.rt=this._currentAnimationRepeatTo);this.IsAnimationPlaying()||(g.ap=this.IsAnimationPlaying());this.IsPlayingForwards()||
(g.af=this.IsPlayingForwards());l=this.GetWorldInfo();l.IsCollisionEnabled()&&(g.ce=l.IsCollisionEnabled());return g}LoadFromJson(g){var l=this.GetObjectClass().GetAnimationBySID(g.a);l&&(this._currentAnimation=l);this._frameStartTime=g.hasOwnProperty("fs")?g.fs:0;this._animationTimer.Set(g.hasOwnProperty("at")?g.at:0);l=g.hasOwnProperty("f")?g.f:0;this._currentFrameIndex=e.clamp(l,0,this._currentAnimation.GetFrameCount()-1);this._currentAnimationSpeed=g.hasOwnProperty("cas")?g.cas:0;this._animationRepeats=
g.hasOwnProperty("ar")?g.ar:1;l=g.hasOwnProperty("rt")?g.rt:0;this._currentAnimationRepeatTo=e.clamp(l,0,this._currentAnimation.GetFrameCount()-1);this.SetAnimationPlaying(g.hasOwnProperty("ap")?!!g.ap:!0);this.SetPlayingForwards(g.hasOwnProperty("af")?!!g.af:!0);this._currentAnimationFrame=l=this._currentAnimation.GetFrameAt(this._currentFrameIndex);this._UpdateCurrentTexture();const m=this.GetWorldInfo();m.SetOriginX(l.GetOriginX());m.SetOriginY(l.GetOriginY());m.SetSourceCollisionPoly(l.GetCollisionPoly());
m.SetCollisionEnabled(!!g.ce)}GetPropertyValueByIndex(g){const l=this.GetWorldInfo();switch(g){case 3:return l.IsCollisionEnabled();case 2:return e.clamp(this._currentFrameIndex,0,this._currentAnimation.GetFrameCount()-1)}}SetPropertyValueByIndex(g,l){var m=this.GetWorldInfo();switch(g){case 3:m.SetCollisionEnabled(!!l);break;case 2:this.SetAnimationPlaying(!1);g=this._currentAnimation.GetFrameCount()-1;m=l=e.clamp(l,0,g);l=this._currentAnimation.GetFrameAt(this._currentFrameIndex);const u=this._currentAnimation.GetFrameAt(m);
this._OnFrameChanged(l,u);this._currentFrameIndex=e.clamp(m,0,g)}}GetScriptInterfaceClass(){return self.ISpriteInstance}};const f=new WeakMap,h=new Map([["current-frame",0],["beginning",1]]);self.ISpriteInstance=class extends self.IWorldInstance{constructor(){super();f.set(this,self.IInstance._GetInitInst().GetSdkInstance())}getImagePointCount(){return f.get(this).GetImagePointCount()}getImagePointX(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(g)[0]}getImagePointY(g){if("string"!==
typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(g)[1]}getImagePoint(g){if("string"!==typeof g&&"number"!==typeof g)throw new TypeError("expected string or number");return f.get(this).GetImagePoint(g)}getPolyPointCount(){return f.get(this).GetCollisionPolyPointCount()}getPolyPointX(g){b.RequireFiniteNumber(g);return f.get(this).GetCollisionPolyPoint(g)[0]}getPolyPointY(g){b.RequireFiniteNumber(g);return f.get(this).GetCollisionPolyPoint(g)[1]}getPolyPoint(g){b.RequireFiniteNumber(g);
return f.get(this).GetCollisionPolyPoint(g)}stopAnimation(){f.get(this).SetAnimationPlaying(!1)}startAnimation(g="current-frame"){b.RequireString(g);g=h.get(g);if("undefined"===typeof g)throw Error("invalid mode");f.get(this)._StartAnim(g)}setAnimation(g,l="beginning"){b.RequireString(g);b.RequireString(l);l=h.get(l);if("undefined"===typeof l)throw Error("invalid mode");f.get(this)._SetAnim(g,l)}getAnimation(g){b.RequireString(g);return(g=f.get(this).GetObjectClass().GetAnimationByName(g))?g.GetIAnimation():
null}get animation(){return f.get(this)._GetCurrentAnimation().GetIAnimation()}get animationName(){return f.get(this)._GetCurrentAnimationName()}set animationFrame(g){b.RequireFiniteNumber(g);f.get(this)._SetAnimFrame(g)}get animationFrame(){return f.get(this)._GetAnimFrame()}set animationSpeed(g){b.RequireFiniteNumber(g);f.get(this)._SetAnimSpeed(g)}get animationSpeed(){return f.get(this)._GetAnimSpeed()}set animationRepeatToFrame(g){b.RequireFiniteNumber(g);f.get(this)._SetAnimRepeatToFrame(g)}get animationRepeatToFrame(){return f.get(this)._GetAnimRepeatToFrame()}get imageWidth(){return f.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return f.get(this).GetCurrentImageInfo().GetHeight()}}}
{"use strict";const e=self.C3;e.Plugins.Sprite.Cnds={IsAnimPlaying(b){return e.equalsNoCase(this._GetCurrentAnimationName(),b)},CompareFrame(b,a){return e.compare(this._currentFrameIndex,b,a)},CompareAnimSpeed(b,a){return e.compare(this._GetAnimSpeed(),b,a)},OnAnimFinished(b){return e.equalsNoCase(this._animTriggerName,b)},OnAnyAnimFinished(){return!0},OnFrameChanged(){return!0},IsMirrored(){return 0>this.GetWorldInfo().GetWidth()},IsFlipped(){return 0>this.GetWorldInfo().GetHeight()},OnURLLoaded(){return!0},
OnURLFailed(){return!0},IsCollisionEnabled(){return this.GetWorldInfo().IsCollisionEnabled()}}}
{"use strict";const e=self.C3;e.Plugins.Sprite.Acts={Spawn(b,a,d,c){if(b&&a){var [f,h]=this.GetImagePoint(d);if(d=this._runtime.CreateInstance(b,a,f,h,c)){c&&a.SortAndAddInstancesByZIndex(d);b.GetPlugin().IsRotatable()&&(a=d.GetWorldInfo(),a.SetAngle(this.GetWorldInfo().GetAngle()),a.SetBboxChanged());a=this._runtime.GetEventSheetManager();a.BlockFlushingInstances(!0);d._TriggerOnCreatedOnSelfAndRelated();a.BlockFlushingInstances(!1);c=this._runtime.GetCurrentAction().GetSavedDataMap();a=!1;if(!c.has("Spawn_LastExec")||
c.get("Spawn_LastExec")<this._runtime.GetExecCount())a=!0,c.set("Spawn_LastExec",this._runtime.GetExecCount());if(b!==this.GetObjectClass()&&(b=b.GetCurrentSol(),b._SetSelectAll(!1),b=b._GetOwnInstances(),a&&e.clearArray(b),b.push(d),d.IsInContainer()))for(const g of d.siblings())d=g.GetObjectClass().GetCurrentSol(),a?d.SetSinglePicked(g):(d._SetSelectAll(!1),d._PushInstance(g))}}},StopAnim(){this.SetAnimationPlaying(!1)},StartAnim(b){this._StartAnim(b)},SetAnim(b,a){this._SetAnim(b,a)},SetAnimFrame(b){this._SetAnimFrame(b)},
SetAnimSpeed(b){this._SetAnimSpeed(b)},SetAnimRepeatToFrame(b){this._SetAnimRepeatToFrame(b)},SetMirrored(b){const a=this.GetWorldInfo(),d=a.GetWidth();b=Math.abs(d)*(0===b?-1:1);d!==b&&(a.SetWidth(b),a.SetBboxChanged())},SetFlipped(b){const a=this.GetWorldInfo(),d=a.GetHeight();b=Math.abs(d)*(0===b?-1:1);d!==b&&(a.SetHeight(b),a.SetBboxChanged())},SetScale(b){const a=this._currentAnimationFrame.GetImageInfo(),d=this.GetWorldInfo();var c=0>d.GetWidth()?-1:1;const f=0>d.GetHeight()?-1:1;c*=a.GetWidth()*
b;b=a.GetHeight()*b*f;if(d.GetWidth()!==c||d.GetHeight()!==b)d.SetSize(c,b),d.SetBboxChanged()},async LoadURL(b,a,d){d=this._currentAnimationFrame.GetImageInfo();const c=this.GetWorldInfo(),f=this._runtime;if(d.GetURL()===b)0===a&&(c.SetSize(d.GetWidth(),d.GetHeight()),c.SetBboxChanged()),this.Trigger(e.Plugins.Sprite.Cnds.OnURLLoaded);else{var h=e.New(e.ImageInfo);try{await h.LoadDynamicAsset(f,b);if(!h.IsLoaded())throw Error("image failed to load");await h.LoadStaticTexture(f.GetRenderer(),{sampling:this._runtime.GetSampling()})}catch(g){console.error("Load image from URL failed: ",
g);this.Trigger(e.Plugins.Sprite.Cnds.OnURLFailed);return}d.ReplaceWith(h);this._sdkType._UpdateAllCurrentTexture();this.WasReleased()||0!==a||(c.SetSize(d.GetWidth(),d.GetHeight()),c.SetBboxChanged());f.UpdateRender();this.WasReleased()||await this.TriggerAsync(e.Plugins.Sprite.Cnds.OnURLLoaded)}},SetCollisions(b){this.GetWorldInfo().SetCollisionEnabled(b)},SetSolidCollisionFilter(b,a){this.GetWorldInfo().SetSolidCollisionFilter(0===b,a)},SetEffect(b){this.GetWorldInfo().SetBlendMode(b);this._runtime.UpdateRender()}}}"use strict";
self.C3.Plugins.Sprite.Exps={AnimationFrame(){return this._currentFrameIndex},AnimationFrameCount(){return this._currentAnimation.GetFrameCount()},AnimationName(){return this._currentAnimation.GetName()},AnimationSpeed(){return this._GetAnimSpeed()},OriginalAnimationSpeed(){return this._currentAnimation.GetSpeed()},ImagePointX(e){return this.GetImagePoint(e)[0]},ImagePointY(e){return this.GetImagePoint(e)[1]},ImagePointCount(){return this.GetImagePointCount()},ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},
ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},PolyPointXAt(e){return this.GetCollisionPolyPoint(e)[0]},PolyPointYAt(e){return this.GetCollisionPolyPoint(e)[1]},PolyPointCount(){return this.GetCollisionPolyPointCount()}};{"use strict";const e=self.C3;e.Plugins.Text=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Plugins.Text.Type=class extends e.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}LoadTextures(b){}ReleaseTextures(){}}}
{"use strict";const e=self.C3,b=self.C3X,a=[0,0,0],d=["left","center","right"],c=["top","center","bottom"],f=new e.Rect,h=new e.Quad,g=new e.Color;e.Plugins.Text.Instance=class extends e.SDKWorldInstanceBase{constructor(q,t){super(q);this._text="";this._enableBBcode=!0;this._faceName="Arial";this._ptSize=12;this._lineHeightOffset=0;this._isItalic=this._isBold=!1;this._color=e.New(e.Color);this._verticalAlign=this._horizontalAlign=0;this._wrapByWord=!0;this._typewriterEndTime=this._typewriterStartTime=
-1;this._typewriterLength=0;this._rendererText=e.New(e.Gfx.RendererText,this._runtime.GetRenderer(),{timeout:5});this._rendererText.ontextureupdate=()=>this._runtime.UpdateRender();this._rendererText.SetIsAsync(!1);t&&(this._text=t[0],this._enableBBcode=!!t[1],this._faceName=t[2],this._ptSize=t[3],this._lineHeightOffset=t[4],this._isBold=!!t[5],this._isItalic=!!t[6],this._horizontalAlign=t[8],this._verticalAlign=t[9],this._wrapByWord=0===t[10],q=t[7],this._color.setRgb(q[0],q[1],q[2]),this.GetWorldInfo().SetVisible(t[11]));
this._UpdateTextSettings()}Release(){this._CancelTypewriter();this._rendererText.Release();this._rendererText=null;super.Release()}_UpdateTextSettings(){const q=this._rendererText;q.SetText(this._text);q.SetBBCodeEnabled(this._enableBBcode);q.SetFontName(this._faceName);q.SetLineHeight(this._lineHeightOffset);q.SetBold(this._isBold);q.SetItalic(this._isItalic);q.SetColor(this._color);q.SetHorizontalAlignment(d[this._horizontalAlign]);q.SetVerticalAlignment(c[this._verticalAlign]);q.SetWordWrapMode(this._wrapByWord?
"word":"character")}_UpdateTextSize(){const q=this.GetWorldInfo();this._rendererText.SetFontSize(this._ptSize);this._rendererText.SetFontSizeScale(q.GetSceneGraphScale());var t=q.GetLayer();t=t.GetRenderScale()*t.Get2DScaleFactorToZ(q.GetTotalZElevation());this._rendererText.SetSize(q.GetWidth(),q.GetHeight(),t)}Draw(q){var t=this.GetWorldInfo();this._UpdateTextSize();const p=this._rendererText.GetTexture();if(p){var r=t.GetLayer();if(0===t.GetAngle()&&0===r.GetAngle()&&0===t.GetTotalZElevation()&&
!t.HasMesh()&&r.RendersIn2DMode()){t=t.GetBoundingQuad();const [x,y]=r.LayerToDrawSurface(t.getTlx(),t.getTly()),[D,G]=r.LayerToDrawSurface(t.getBrx(),t.getBry());t=x-Math.round(x);const A=y-Math.round(y);f.set(x,y,D,G);f.offset(-t,-A);h.setFromRect(f);const [F,J]=q.GetRenderTargetSize(q.GetRenderTarget());this._runtime.GetCanvasManager().SetDeviceTransform(q,F,J);q.SetTexture(p);q.Quad3(h,this._rendererText.GetTexRect());r._SetTransform(q)}else q.SetTexture(p),t.HasMesh()?this._DrawMesh(t,q):this._DrawStandard(t,
q)}}_DrawStandard(q,t){q=q.GetBoundingQuad();this._runtime.IsPixelRoundingEnabled()&&(q=this._PixelRoundQuad(q));t.Quad3(q,this._rendererText.GetTexRect())}_DrawMesh(q,t){const p=q.GetTransformedMesh();if(q.IsMeshChanged()){q.CalculateBbox(f,h,!1);let r=h;this._runtime.IsPixelRoundingEnabled()&&(r=this._PixelRoundQuad(r));p.CalculateTransformedMesh(q.GetSourceMesh(),r,this._rendererText.GetTexRect());q.SetMeshChanged(!1)}p.Draw(t)}_PixelRoundQuad(q){const t=q.getTlx()-Math.round(q.getTlx()),p=q.getTly()-
Math.round(q.getTly());if(0===t&&0===p)return q;h.copy(q);h.offset(-t,-p);return h}GetCurrentSurfaceSize(){const q=this._rendererText.GetTexture();return q?[q.GetWidth(),q.GetHeight()]:[100,100]}GetCurrentTexRect(){return this._rendererText.GetTexRect()}IsCurrentTexRotated(){return!1}SaveToJson(){const q={t:this._text,c:this._color.toJSON(),fn:this._faceName,ps:this._ptSize};this._enableBBcode&&(q.bbc=this._enableBBcode);0!==this._horizontalAlign&&(q.ha=this._horizontalAlign);0!==this._verticalAlign&&
(q.va=this._verticalAlign);this._wrapByWord||(q.wr=this._wrapByWord);0!==this._lineHeightOffset&&(q.lho=this._lineHeightOffset);this._isBold&&(q.b=this._isBold);this._isItalic&&(q.i=this._isItalic);-1!==this._typewriterEndTime&&(q.tw={st:this._typewriterStartTime,en:this._typewriterEndTime,l:this._typewriterLength});return q}LoadFromJson(q){this._CancelTypewriter();this._text=q.t;this._color.setFromJSON(q.c);this._faceName=q.fn;this._ptSize=q.ps;this._enableBBcode=q.hasOwnProperty("bbc")?q.bbc:!1;
this._horizontalAlign=q.hasOwnProperty("ha")?q.ha:0;this._verticalAlign=q.hasOwnProperty("va")?q.va:0;this._wrapByWord=q.hasOwnProperty("wr")?q.wr:!0;this._lineHeightOffset=q.hasOwnProperty("lho")?q.lho:0;this._isBold=q.hasOwnProperty("b")?q.b:!1;this._isItalic=q.hasOwnProperty("i")?q.i:!1;q.hasOwnProperty("tw")&&(q=q.tw,this._typewriterStartTime=q.st,this._typewriterEndTime=q.en,this._typewriterLength=q.l);this._UpdateTextSettings();-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(q){switch(q){case 0:return this._text;
case 1:return this._enableBBcode;case 2:return this._faceName;case 3:return this._ptSize;case 4:return this._lineHeightOffset;case 5:return this._isBold;case 6:return this._isItalic;case 7:return a[0]=this._color.getR(),a[1]=this._color.getG(),a[2]=this._color.getB(),a;case 8:return this._horizontalAlign;case 9:return this._verticalAlign;case 10:return this._wrapByWord?1:0}}SetPropertyValueByIndex(q,t){switch(q){case 0:if(this._text===t)break;this._text=t;this._UpdateTextSettings();break;case 1:if(this._enableBBcode===
!!t)break;this._enableBBcode=!!t;this._UpdateTextSettings();break;case 2:if(this._faceName===t)break;this._faceName=t;this._UpdateTextSettings();break;case 3:if(this._ptSize===t)break;this._ptSize=t;this._UpdateTextSettings();break;case 4:if(this._lineHeightOffset===t)break;this._lineHeightOffset=t;this._UpdateTextSettings();break;case 5:if(this._isBold===!!t)break;this._isBold=!!t;this._UpdateTextSettings();break;case 6:if(this._isItalic===!!t)break;this._isItalic=!!t;this._UpdateTextSettings();
break;case 7:q=this._color;if(q.getR()===t[0]&&q.getG()===t[1]&&q.getB()===t[2])break;this._color.setRgb(t[0],t[1],t[2]);this._UpdateTextSettings();break;case 8:if(this._horizontalAlign===t)break;this._horizontalAlign=t;this._UpdateTextSettings();break;case 9:if(this._verticalAlign===t)break;this._verticalAlign=t;this._UpdateTextSettings();break;case 10:this._wrapByWord!==(0===t)&&(this._wrapByWord=0===t,this._UpdateTextSettings())}}SetPropertyColorOffsetValueByIndex(q,t,p,r){if(0!==t||0!==p||0!==
r)switch(q){case 7:this._color.addRgb(t,p,r),this._UpdateTextSettings()}}_SetText(q){this._text!==q&&(this._text=q,this._rendererText.SetText(q),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(q,t){this._SetText(q);this._typewriterStartTime=this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+t/this.GetInstance().GetActiveTimeScale();this._typewriterLength=e.BBString.StripAnyTags(q).length;this._rendererText.SetDrawMaxCharacterCount(0);this._StartTicking()}_CancelTypewriter(){this._typewriterEndTime=
this._typewriterStartTime=-1;this._typewriterLength=0;this._rendererText.SetDrawMaxCharacterCount(-1);this._StopTicking()}_FinishTypewriter(){-1!==this._typewriterEndTime&&(this._CancelTypewriter(),this.Trigger(e.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender())}_SetFontFace(q){this._faceName!==q&&(this._faceName=q,this._rendererText.SetFontName(q),this._runtime.UpdateRender())}_GetFontFace(){return this._faceName}_SetBold(q){q=!!q;this._isBold!==q&&(this._isBold=q,this._rendererText.SetBold(q),
this._runtime.UpdateRender())}_IsBold(){return this._isBold}_SetItalic(q){q=!!q;this._isItalic!==q&&(this._isItalic=q,this._rendererText.SetItalic(q),this._runtime.UpdateRender())}_IsItalic(){return this._isItalic}_SetFontSize(q){this._ptSize!==q&&(this._ptSize=q,this._runtime.UpdateRender())}_GetFontSize(){return this._ptSize}_SetFontColor(q){this._color.equalsIgnoringAlpha(q)||(this._color.copyRgb(q),this._rendererText.SetColor(this._color),this._runtime.UpdateRender())}_GetFontColor(){return this._color}_SetLineHeight(q){this._lineHeightOffset!==
q&&(this._lineHeightOffset=q,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeightOffset}_SetHAlign(q){this._horizontalAlign!==q&&(this._horizontalAlign=q,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(q){this._verticalAlign!==q&&(this._verticalAlign=q,this._UpdateTextSettings(),this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(q){q=!!q;this._wrapByWord!==q&&
(this._wrapByWord=q,this._UpdateTextSettings(),this._runtime.UpdateRender())}_IsWrapByWord(){return this._wrapByWord}_GetTextWidth(){this._UpdateTextSize();return this._rendererText.GetTextWidth()}_GetTextHeight(){this._UpdateTextSize();return this._rendererText.GetTextHeight()}Tick(){var q=this._runtime.GetWallTime();q>=this._typewriterEndTime?(this._CancelTypewriter(),this.Trigger(e.Plugins.Text.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender()):(q=e.relerp(this._typewriterStartTime,this._typewriterEndTime,
q,0,this._typewriterLength),q=Math.floor(q),q!==this._rendererText.GetDrawMaxCharacterCount()&&(this._rendererText.SetDrawMaxCharacterCount(q),this._runtime.UpdateRender()))}GetDebuggerProperties(){return[{title:"plugins.text.name",properties:[{name:"plugins.text.properties.text.name",value:this._text,onedit:q=>this._SetText(q)}]}]}GetScriptInterfaceClass(){return self.ITextInstance}};const l=new WeakMap,m=new Map([["left",0],["center",1],["right",2]]),u=new Map([["top",0],["center",1],["bottom",
2]]),w=new Map([["word",!0],["character",!1]]);self.ITextInstance=class extends self.IWorldInstance{constructor(){super();l.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return l.get(this).GetText()}set text(q){b.RequireString(q);const t=l.get(this);t._CancelTypewriter();t._SetText(q)}typewriterText(q,t){b.RequireString(q);b.RequireFiniteNumber(t);const p=l.get(this);p._CancelTypewriter();p._StartTypewriter(q,t)}typewriterFinish(){l.get(this)._FinishTypewriter()}set fontFace(q){b.RequireString(q);
l.get(this)._SetFontFace(q)}get fontFace(){return l.get(this)._GetFontFace()}set isBold(q){l.get(this)._SetBold(q)}get isBold(){return l.get(this)._IsBold()}set isItalic(q){l.get(this)._SetItalic(q)}get isItalic(){return l.get(this)._IsItalic()}set sizePt(q){b.RequireFiniteNumber(q);l.get(this)._SetFontSize(q)}get sizePt(){return l.get(this)._GetFontSize()}set fontColor(q){b.RequireArray(q);if(3>q.length)throw Error("expected 3 elements");g.setRgb(q[0],q[1],q[2]);l.get(this)._SetFontColor(g)}get fontColor(){const q=
l.get(this)._GetFontColor();return[q.getR(),q.getG(),q.getB()]}set lineHeight(q){b.RequireFiniteNumber(q);l.get(this)._SetLineHeight(q)}get lineHeight(){return l.get(this)._GetLineHeight()}set horizontalAlign(q){b.RequireString(q);q=m.get(q);if("undefined"===typeof q)throw Error("invalid mode");l.get(this)._SetHAlign(q)}get horizontalAlign(){return d[l.get(this)._GetHAlign()]}set verticalAlign(q){b.RequireString(q);q=u.get(q);if("undefined"===typeof q)throw Error("invalid mode");l.get(this)._SetVAlign(q)}get verticalAlign(){return c[l.get(this)._GetVAlign()]}set wordWrapMode(q){b.RequireString(q);
q=w.get(q);if("undefined"===typeof q)throw Error("invalid mode");l.get(this)._SetWrapByWord(q)}get wordWrapMode(){return l.get(this)._IsWrapByWord()?"word":"character"}get textWidth(){return l.get(this)._GetTextWidth()}get textHeight(){return l.get(this)._GetTextHeight()}}}{"use strict";const e=self.C3;e.Plugins.Text.Cnds={CompareText(b,a){return a?this._text===b:e.equalsNoCase(this._text,b)},IsRunningTypewriterText(){return-1!==this._typewriterEndTime},OnTypewriterTextFinished(){return!0}}}
{"use strict";const e=self.C3,b=e.New(e.Color);e.Plugins.Text.Acts={SetText(a){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);this._SetText(a.toString())},AppendText(a){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);(a=a.toString())&&this._SetText(this._text+a)},TypewriterText(a,d){this._CancelTypewriter();"number"===typeof a&&1E9>a&&(a=Math.round(1E10*a)/1E10);this._StartTypewriter(a.toString(),d)},SetFontFace(a,d){let c=!1,f=!1;
switch(d){case 1:c=!0;break;case 2:f=!0;break;case 3:f=c=!0}if(a!==this._faceName||c!==this._isBold||f!==this._isItalic)this._SetFontFace(a),this._SetBold(c),this._SetItalic(f)},SetFontSize(a){this._SetFontSize(a)},SetFontColor(a){b.setFromRgbValue(a);b.clamp();this._SetFontColor(b)},SetWebFont(a,d){console.warn("[Text] 'Set web font' action is deprecated and no longer has any effect")},SetEffect(a){this.GetWorldInfo().SetBlendMode(a);this._runtime.UpdateRender()},TypewriterFinish(){this._FinishTypewriter()},
SetLineHeight(a){this._SetLineHeight(a)},SetHAlign(a){this._SetHAlign(a)},SetVAlign(a){this._SetVAlign(a)},SetWrapping(a){this._SetWrapByWord(0===a)}}}{"use strict";const e=self.C3;e.Plugins.Text.Exps={Text(){return this._text},PlainText(){return this._enableBBcode?e.BBString.StripAnyTags(this._text):this._text},FaceName(){return this._faceName},FaceSize(){return this._ptSize},TextWidth(){return this._GetTextWidth()},TextHeight(){return this._GetTextHeight()},LineHeight(){return this._lineHeightOffset}}}
{"use strict";const e=self.C3;e.Plugins.Touch=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3,b=self.C3X;e.Plugins.Touch.Type=class extends e.SDKTypeBase{constructor(c){super(c)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.ITouchObjectType}};let a=null;function d(){return a.GetSingleGlobalInstance().GetSdkInstance()}self.ITouchObjectType=class extends self.IObjectClass{constructor(c){super(c);a=c;c.GetRuntime()._GetCommonScriptInterfaces().touch=this}requestPermission(c){b.RequireString(c);const f=d();if("orientation"===c)return f._RequestPermission(0);
if("motion"===c)return f._RequestPermission(1);throw Error("invalid type");}}}
{"use strict";const e=self.C3;e.Plugins.Touch.Instance=class extends e.SDKInstanceBase{constructor(b,a){super(b,"touch");this._touches=new Map;this._isMouseDown=this._useMouseInput=!1;this._getTouchIndex=this._curTouchY=this._curTouchX=this._triggerPermission=this._triggerId=this._triggerIndex=this._accWithGZ=this._accWithGY=this._accWithGX=this._accZ=this._accY=this._accX=this._orientGamma=this._orientBeta=this._orientAlpha=this._orientCompassHeading=0;this._permissionPromises=[];a&&(this._useMouseInput=
a[0]);this.AddDOMMessageHandler("permission-result",d=>this._OnPermissionResult(d));b=this.GetRuntime().Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(b,"pointerdown",d=>this._OnPointerDown(d.data)),e.Disposable.From(b,"pointermove",d=>this._OnPointerMove(d.data)),e.Disposable.From(b,"pointerup",d=>this._OnPointerUp(d.data,!1)),e.Disposable.From(b,"pointercancel",d=>this._OnPointerUp(d.data,!0)),e.Disposable.From(b,"deviceorientation",d=>this._OnDeviceOrientation(d.data)),
e.Disposable.From(b,"deviceorientationabsolute",d=>this._OnDeviceOrientationAbsolute(d.data)),e.Disposable.From(b,"devicemotion",d=>this._OnDeviceMotion(d.data)),e.Disposable.From(b,"tick2",d=>this._OnTick2()))}Release(){this._touches.clear();super.Release()}_OnPointerDown(b){if("mouse"===b.pointerType)if(this._useMouseInput)this._isMouseDown=!0;else return;const a=b.pointerId;if(!this._touches.has(a)){var d=b.pageX-this._runtime.GetCanvasClientX();b=b.pageY-this._runtime.GetCanvasClientY();var c=
performance.now(),f=this._touches.size;this._triggerIndex=f;this._triggerId=a;var h=e.New(e.Plugins.Touch.TouchInfo);h.Init(c,d,b,a,f);this._touches.set(a,h);this.Trigger(e.Plugins.Touch.Cnds.OnNthTouchStart);this.Trigger(e.Plugins.Touch.Cnds.OnTouchStart);this._curTouchX=d;this._curTouchY=b;this.Trigger(e.Plugins.Touch.Cnds.OnTouchObject)}}_OnPointerMove(b){if("mouse"!==b.pointerType||this._isMouseDown){var a=this._touches.get(b.pointerId);if(a){var d=performance.now();if(!(2>d-a.GetTime())){var c=
b.pageX-this._runtime.GetCanvasClientX(),f=b.pageY-this._runtime.GetCanvasClientY();a.Update(d,c,f,b.width,b.height,b.pressure)}}}}_OnPointerUp(b,a){if("mouse"===b.pointerType)if(this._isMouseDown)this._isMouseDown=!1;else return;const d=performance.now();b=b.pointerId;const c=this._touches.get(b);c&&(this._triggerIndex=c.GetStartIndex(),this._triggerId=c.GetId(),this.Trigger(e.Plugins.Touch.Cnds.OnNthTouchEnd),this.Trigger(e.Plugins.Touch.Cnds.OnTouchEnd),a||(a=c.ShouldTriggerTap(d),"single-tap"===
a?(this.Trigger(e.Plugins.Touch.Cnds.OnTapGesture),this._curTouchX=c.GetX(),this._curTouchY=c.GetY(),this.Trigger(e.Plugins.Touch.Cnds.OnTapGestureObject)):"double-tap"===a&&(this.Trigger(e.Plugins.Touch.Cnds.OnDoubleTapGesture),this._curTouchX=c.GetX(),this._curTouchY=c.GetY(),this.Trigger(e.Plugins.Touch.Cnds.OnDoubleTapGestureObject))),c.Release(),this._touches.delete(b))}_RequestPermission(b){this._PostToDOMMaybeSync("request-permission",{type:b});return new Promise((a,d)=>{this._permissionPromises.push({type:b,
resolve:a,reject:d})})}_OnPermissionResult(b){const a=b.result,d=b.type;this._triggerPermission=d;b=this._permissionPromises.filter(c=>c.type===d);for(const c of b)c.resolve(a?"granted":"denied");this._permissionPromises=this._permissionPromises.filter(c=>c.type!==d);a?(this.Trigger(e.Plugins.Touch.Cnds.OnPermissionGranted),0===d?this._runtime.RequestDeviceOrientationEvent():this._runtime.RequestDeviceMotionEvent()):this.Trigger(e.Plugins.Touch.Cnds.OnPermissionDenied)}_OnDeviceOrientation(b){"number"===
typeof b.webkitCompassHeading?this._orientCompassHeading=b.webkitCompassHeading:b.absolute&&(this._orientCompassHeading=b.alpha);this._orientAlpha=b.alpha;this._orientBeta=b.beta;this._orientGamma=b.gamma}_OnDeviceOrientationAbsolute(b){this._orientCompassHeading=b.alpha}_OnDeviceMotion(b){const a=b.acceleration;a&&(this._accX=a.x,this._accY=a.y,this._accZ=a.z);if(b=b.accelerationIncludingGravity)this._accWithGX=b.x,this._accWithGY=b.y,this._accWithGZ=b.z}_OnTick2(){const b=performance.now();let a=
0;for(const d of this._touches.values())d.GetTime()<=b-50&&d._SetLastTime(b),d.ShouldTriggerHold(b)&&(this._triggerIndex=d.GetStartIndex(),this._triggerId=d.GetId(),this._getTouchIndex=a,this.Trigger(e.Plugins.Touch.Cnds.OnHoldGesture),this._curTouchX=d.GetX(),this._curTouchY=d.GetY(),this.Trigger(e.Plugins.Touch.Cnds.OnHoldGestureObject),this._getTouchIndex=0),++a}_GetTouchByIndex(b){b=Math.floor(b);for(const a of this._touches.values()){if(0===b)return a;--b}return null}_IsClientPosOnCanvas(b,a){return 0<=
b&&0<=a&&b<this._runtime.GetCanvasCssWidth()&&a<this._runtime.GetCanvasCssHeight()}GetDebuggerProperties(){return[{title:"plugins.touch.debugger.touches",properties:[...this._touches.values()].map(b=>({name:"$"+b.GetId(),value:b.GetX()+", "+b.GetY()}))}]}}}
{"use strict";const e=self.C3,b=[];e.Plugins.Touch.Cnds={OnTouchStart(){return!0},OnTouchEnd(){return!0},IsInTouch(){return 0<this._touches.size},OnTouchObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,this._curTouchX,this._curTouchY,!1):!1},IsTouchingObject(a){if(!a)return!1;const d=a.GetCurrentSol();var c=d.GetInstances();for(const f of c){c=f.GetWorldInfo();const h=c.GetLayer();for(const g of this._touches.values()){if(!this._IsClientPosOnCanvas(g.GetX(),
g.GetY()))continue;const [l,m]=h.CanvasCssToLayer(g.GetX(),g.GetY(),c.GetTotalZElevation());if(h.IsSelfAndParentsInteractive()&&c.ContainsPoint(l,m)){b.push(f);break}}}return b.length?(d.SetArrayPicked(b),a.ApplySolToContainer(),e.clearArray(b),!0):!1},CompareTouchSpeed(a,d,c){return(a=this._GetTouchByIndex(a))?e.compare(a.GetSpeed(),d,c):!1},OrientationSupported(){return!0},MotionSupported(){return!0},CompareOrientation(a,d,c){this._runtime.RequestDeviceOrientationEvent();return e.compare(0===a?
this._orientAlpha:1===a?this._orientBeta:this._orientGamma,d,c)},CompareAcceleration(a,d,c){this._runtime.RequestDeviceMotionEvent();return e.compare(0===a?this._accWithGX:1===a?this._accWithGY:2===a?this._accWithGZ:3===a?this._accX:4===a?this._accY:this._accZ,d,c)},OnNthTouchStart(a){a=Math.floor(a);return a===this._triggerIndex},OnNthTouchEnd(a){a=Math.floor(a);return a===this._triggerIndex},HasNthTouch(a){a=Math.floor(a);return this._touches.size>=a+1},OnHoldGesture(){return!0},OnTapGesture(){return!0},
OnDoubleTapGesture(){return!0},OnHoldGestureObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,this._curTouchX,this._curTouchY,!1):!1},OnTapGestureObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,this._curTouchX,this._curTouchY,!1):!1},OnDoubleTapGestureObject(a){return a&&this._IsClientPosOnCanvas(this._curTouchX,
this._curTouchY)?this._runtime.GetCollisionEngine().TestAndSelectCanvasPointOverlap(a,this._curTouchX,this._curTouchY,!1):!1},OnPermissionGranted(a){return this._triggerPermission===a},OnPermissionDenied(a){return this._triggerPermission===a}}}"use strict";self.C3.Plugins.Touch.Acts={RequestPermission(e){this._RequestPermission(e)}};
{"use strict";const e=self.C3;e.Plugins.Touch.Exps={TouchCount(){return this._touches.size},X(b){const a=this._GetTouchByIndex(this._getTouchIndex);return a?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!0):0},Y(b){const a=this._GetTouchByIndex(this._getTouchIndex);return a?a.GetPositionForLayer(this._runtime.GetCurrentLayout(),b,!1):0},XAt(b,a){return(b=this._GetTouchByIndex(b))?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!0):0},YAt(b,a){return(b=this._GetTouchByIndex(b))?
b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!1):0},XForID(b,a){return(b=this._touches.get(b))?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!0):0},YForID(b,a){return(b=this._touches.get(b))?b.GetPositionForLayer(this._runtime.GetCurrentLayout(),a,!1):0},AbsoluteX(){const b=this._GetTouchByIndex(0);return b?b.GetX():0},AbsoluteY(){const b=this._GetTouchByIndex(0);return b?b.GetY():0},AbsoluteXAt(b){return(b=this._GetTouchByIndex(b))?b.GetX():0},AbsoluteYAt(b){return(b=this._GetTouchByIndex(b))?
b.GetY():0},AbsoluteXForID(b){return(b=this._touches.get(b))?b.GetX():0},AbsoluteYForID(b){return(b=this._touches.get(b))?b.GetY():0},SpeedAt(b){return(b=this._GetTouchByIndex(b))?b.GetSpeed():0},SpeedForID(b){return(b=this._touches.get(b))?b.GetSpeed():0},AngleAt(b){return(b=this._GetTouchByIndex(b))?e.toDegrees(b.GetAngle()):0},AngleForID(b){return(b=this._touches.get(b))?e.toDegrees(b.GetAngle()):0},CompassHeading(){this._runtime.RequestDeviceOrientationEvent();return this._orientCompassHeading},
Alpha(){this._runtime.RequestDeviceOrientationEvent();return this._orientAlpha},Beta(){this._runtime.RequestDeviceOrientationEvent();return this._orientBeta},Gamma(){this._runtime.RequestDeviceOrientationEvent();return this._orientGamma},AccelerationXWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGX},AccelerationYWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGY},AccelerationZWithG(){this._runtime.RequestDeviceMotionEvent();return this._accWithGZ},AccelerationX(){this._runtime.RequestDeviceMotionEvent();
return this._accX},AccelerationY(){this._runtime.RequestDeviceMotionEvent();return this._accY},AccelerationZ(){this._runtime.RequestDeviceMotionEvent();return this._accZ},TouchIndex(){return this._triggerIndex},TouchID(){return this._triggerId},WidthForID(b){return(b=this._touches.get(b))?b.GetWidth():0},HeightForID(b){return(b=this._touches.get(b))?b.GetHeight():0},PressureForID(b){return(b=this._touches.get(b))?b.GetPressure():0}}}
{"use strict";const e=self.C3;let b=-1E3,a=-1E3,d=-1E4;e.Plugins.Touch.TouchInfo=class extends e.DefendedBase{constructor(){super();this._pressure=this._height=this._width=this._lastY=this._lastX=this._y=this._x=this._startY=this._startX=this._lastTime=this._time=this._startTime=this._startIndex=this._pointerId=0;this._isTooFarForHold=this._hasTriggeredHold=!1}Release(){}Init(c,f,h,g,l){this._pointerId=g;this._startIndex=l;this._startTime=this._lastTime=this._time=c;this._startX=f;this._startY=h;
this._x=f;this._y=h;this._lastX=f;this._lastY=h}Update(c,f,h,g,l,m){this._lastTime=this._time;this._time=c;this._lastX=this._x;this._lastY=this._y;this._x=f;this._y=h;this._width=g;this._height=l;this._pressure=m;!this._isTooFarForHold&&15<=e.distanceTo(this._startX,this._startY,this._x,this._y)&&(this._isTooFarForHold=!0)}GetId(){return this._pointerId}GetStartIndex(){return this._startIndex}GetTime(){return this._time}_SetLastTime(c){this._lastTime=c}GetX(){return this._x}GetY(){return this._y}GetSpeed(){const c=
e.distanceTo(this._x,this._y,this._lastX,this._lastY),f=(this._time-this._lastTime)/1E3;return 0<f?c/f:0}GetAngle(){return e.angleTo(this._lastX,this._lastY,this._x,this._y)}GetWidth(){return this._width}GetHeight(){return this._height}GetPressure(){return this._pressure}ShouldTriggerHold(c){return this._hasTriggeredHold?!1:500<=c-this._startTime&&!this._isTooFarForHold&&15>e.distanceTo(this._startX,this._startY,this._x,this._y)?this._hasTriggeredHold=!0:!1}ShouldTriggerTap(c){if(this._hasTriggeredHold)return"";
if(333>=c-this._startTime&&!this._isTooFarForHold&&15>e.distanceTo(this._startX,this._startY,this._x,this._y)){if(666>=c-d&&25>e.distanceTo(b,a,this._x,this._y))return a=b=-1E3,d=-1E4,"double-tap";b=this._x;a=this._y;d=c;return"single-tap"}return""}GetPositionForLayer(c,f,h){return"undefined"===typeof f?c.GetLayerByIndex(0).CanvasCssToLayer_DefaultTransform(this._x,this._y)[h?0:1]:(c=c.GetLayer(f))?c.CanvasCssToLayer(this._x,this._y)[h?0:1]:0}}}
{"use strict";const e=self.C3;e.Plugins.Spritefont2=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Plugins.Spritefont2.Type=class extends e.SDKTypeBase{constructor(b){super(b);this._spriteFont=e.New(self.SpriteFont)}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(b){return this.GetImageInfo().LoadStaticTexture(b,{sampling:this._runtime.GetSampling()})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}GetSpriteFont(){return this._spriteFont}UpdateSettings(b,a,d,c){const f=this.GetImageInfo(),h=this._spriteFont;h.SetWidth(f.GetWidth());
h.SetHeight(f.GetHeight());h.SetCharacterWidth(b);h.SetCharacterHeight(a);h.SetCharacterSet(d);h.SetSpacingData(c);h.UpdateCharacterMap()}}}
{"use strict";const e=self.C3,b=self.C3X,a=["left","center","right"],d=["top","center","bottom"];e.Plugins.Spritefont2.Instance=class extends e.SDKWorldInstanceBase{constructor(l,m){super(l);this._text="";this._enableBBcode=!0;this._characterHeight=this._characterWidth=16;this._characterSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#\"'&()[]|`\\/@\u00b0+=*$\u00a3\u20ac<>";l="";this._characterScale=1;this._verticalAlign=this._horizontalAlign=this._lineHeight=this._characterSpacing=
0;this._wrapByWord=!0;this._spriteFontText=null;this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;m&&(this._text=m[0],this._enableBBcode=m[1],this._characterWidth=m[2],this._characterHeight=m[3],this._characterSet=m[4],l=m[5],this._characterScale=m[6],this._characterSpacing=m[7],this._lineHeight=m[8],this._horizontalAlign=m[9],this._verticalAlign=m[10],this._wrapByWord=0===m[11],this.GetWorldInfo().SetVisible(m[12]));this._sdkType.UpdateSettings(this._characterWidth,this._characterHeight,
this._characterSet,l);this._spriteFontText=e.New(self.SpriteFontText,this._sdkType.GetSpriteFont());m=this.GetWorldInfo();this._spriteFontText.SetSize(m.GetWidth(),m.GetHeight());this._UpdateSettings();this._inst.SetMustMitigateZFighting()}Release(){this._CancelTypewriter();this._spriteFontText.Release();this._spriteFontText=null;super.Release()}_UpdateSettings(){const l=this._spriteFontText;l&&(l.SetBBCodeEnabled(this._enableBBcode),l.SetText(this._text),l.SetWordWrapMode(this._wrapByWord?"word":
"character"),l.SetHorizontalAlign(a[this._horizontalAlign]),l.SetVerticalAlign(d[this._verticalAlign]),l.SetSpacing(this._characterSpacing),l.SetLineHeight(this._lineHeight))}Draw(l){const m=this._objectClass.GetImageInfo();var u=m.GetTexture();if(u){l.SetTexture(u);u=this.GetWorldInfo();var w=u.GetBoundingQuad(),q=this._spriteFontText;q.SetScale(this._characterScale);q.SetSceneGraphScale(u.GetSceneGraphScale());this._runtime.IsPixelRoundingEnabled()&&(w=u.PixelRoundQuad(w));q.SetSize(u.GetWidth(),
u.GetHeight());q.GetSpriteFont().SetTexRect(m.GetTexRect());q.SetColor(u.GetUnpremultipliedColor());q.Draw(l,w.getTlx(),w.getTly(),u.GetAngle())}}SaveToJson(){const l={t:this._text,ebbc:this._enableBBcode,csc:this._characterScale,csp:this._characterSpacing,lh:this._lineHeight,ha:this._horizontalAlign,va:this._verticalAlign,w:this._wrapByWord,cw:this._sdkType.GetSpriteFont().GetCharacterWidth(),ch:this._sdkType.GetSpriteFont().GetCharacterHeight(),cs:this._sdkType.GetSpriteFont().GetCharacterSet(),
sd:this._sdkType.GetSpriteFont().GetSpacingData()};-1!==this._typewriterEndTime&&(l.tw={st:this._typewriterStartTime,en:this._typewriterEndTime,l:this._typewriterLength});return l}LoadFromJson(l){this._CancelTypewriter();this._text=l.t;this._enableBBcode=l.ebbc;this._characterScale=l.csc;this._characterSpacing=l.csp;this._lineHeight=l.lh;this._horizontalAlign=l.ha;this._verticalAlign=l.va;this._wrapByWord=l.w;if(l.hasOwnProperty("tw")){var m=l.tw;this._typewriterStartTime=m.st;this._typewriterEndTime=
m.en;this._typewriterLength=l.l}m=this._sdkType.GetSpriteFont();m.SetCharacterWidth(l.cw);m.SetCharacterHeight(l.ch);m.SetCharacterSet(l.cs);m.SetSpacingData(l.sd);this._UpdateSettings();-1!==this._typewriterEndTime&&this._StartTicking()}GetPropertyValueByIndex(l){switch(l){case 0:return this._text;case 1:return this._enableBBcode;case 2:return this._sdkType.GetSpriteFont().GetCharacterWidth();case 3:return this._sdkType.GetSpriteFont().GetCharacterHeight();case 4:return this._sdkType.GetSpriteFont().GetCharacterSet();
case 5:return this._sdkType.GetSpriteFont().GetSpacingData();case 6:return this._characterScale;case 7:return this._characterSpacing;case 8:return this._lineHeight;case 9:return this._horizontalAlign;case 10:return this._verticalAlign;case 11:return this._wrapByWord?1:0}}SetPropertyValueByIndex(l,m){switch(l){case 0:if(this._text===m)break;this._text=m;this._UpdateSettings();break;case 1:if(this._enableBBcode===!!m)break;this._enableBBcode=!!m;this._UpdateSettings();break;case 2:this._sdkType.GetSpriteFont().SetCharacterWidth(m);
break;case 3:this._sdkType.GetSpriteFont().SetCharacterHeight(m);break;case 4:this._sdkType.GetSpriteFont().SetCharacterSet(m);break;case 5:this._sdkType.GetSpriteFont().SetSpacingData(m);break;case 6:if(this._characterScale===m)break;this._characterScale=m;this._UpdateSettings();break;case 7:if(this._characterSpacing===m)break;this._characterSpacing=m;this._UpdateSettings();break;case 8:if(this._lineHeight===m)break;this._lineHeight=m;this._UpdateSettings();break;case 9:if(this._horizontalAlign===
m)break;this._horizontalAlign=m;this._UpdateSettings();break;case 10:if(this._verticalAlign===m)break;this._verticalAlign=m;this._UpdateSettings();break;case 11:this._wrapByWord!==(0===m)&&(this._wrapByWord=0===m,this._UpdateSettings())}}_SetText(l){this._text!==l&&(this._text=l,this._spriteFontText.SetText(l),this._runtime.UpdateRender())}GetText(){return this._text}_StartTypewriter(l,m){this._SetText(l);this._typewriterStartTime=this._runtime.GetWallTime();this._typewriterEndTime=this._typewriterStartTime+
m/this.GetInstance().GetActiveTimeScale();this._typewriterLength=e.BBString.StripAnyTags(l).length;this._spriteFontText.SetDrawMaxCharacterCount(0);this._StartTicking()}_CancelTypewriter(){this._typewriterEndTime=this._typewriterStartTime=-1;this._typewriterLength=0;this._spriteFontText.SetDrawMaxCharacterCount(-1);this._StopTicking()}_FinishTypewriter(){-1!==this._typewriterEndTime&&(this._CancelTypewriter(),this.Trigger(e.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender())}_SetScale(l){this._characterScale!==
l&&(this._characterScale=l,this._spriteFontText.SetScale(this._characterScale),this._runtime.UpdateRender())}_GetScale(){return this._characterScale}_SetCharacterSpacing(l){this._characterSpacing!==l&&(this._characterSpacing=l,this._spriteFontText.SetSpacing(this._characterSpacing),this._runtime.UpdateRender())}_GetCharacterSpacing(){return this._characterSpacing}_SetLineHeight(l){this._lineHeight!==l&&(this._lineHeight=l,this._spriteFontText.SetLineHeight(this._lineHeight),this._runtime.UpdateRender())}_GetLineHeight(){return this._lineHeight}_SetHAlign(l){this._horizontalAlign!==
l&&(this._horizontalAlign=l,this._UpdateSettings(),this._runtime.UpdateRender())}_GetHAlign(){return this._horizontalAlign}_SetVAlign(l){this._verticalAlign!==l&&(this._verticalAlign=l,this._UpdateSettings(),this._runtime.UpdateRender())}_GetVAlign(){return this._verticalAlign}_SetWrapByWord(l){l=!!l;this._wrapByWord!==l&&(this._wrapByWord=l,this._UpdateSettings(),this._runtime.UpdateRender())}_IsWrapByWord(){return this._wrapByWord}Tick(){var l=this._runtime.GetWallTime();l>=this._typewriterEndTime?
(this._CancelTypewriter(),this.Trigger(e.Plugins.Spritefont2.Cnds.OnTypewriterTextFinished),this._runtime.UpdateRender()):(l=e.relerp(this._typewriterStartTime,this._typewriterEndTime,l,0,this._typewriterLength),l=Math.floor(l),l!==this._spriteFontText.GetDrawMaxCharacterCount()&&(this._spriteFontText.SetDrawMaxCharacterCount(l),this._runtime.UpdateRender()))}GetDebuggerProperties(){return[{title:"plugins.spritefont2.name",properties:[{name:"plugins.spritefont2.properties.text.name",value:this._text,
onedit:l=>this._SetText(l)}]}]}GetScriptInterfaceClass(){return self.ISpriteFontInstance}};const c=new WeakMap,f=new Map([["left",0],["center",1],["right",2]]),h=new Map([["top",0],["center",1],["bottom",2]]),g=new Map([["word",!0],["character",!1]]);self.ISpriteFontInstance=class extends self.IWorldInstance{constructor(){super();c.set(this,self.IInstance._GetInitInst().GetSdkInstance())}get text(){return c.get(this).GetText()}set text(l){b.RequireString(l);const m=c.get(this);m._CancelTypewriter();
m._SetText(l)}typewriterText(l,m){b.RequireString(l);b.RequireFiniteNumber(m);const u=c.get(this);u._CancelTypewriter();u._StartTypewriter(l,m)}typewriterFinish(){c.get(this)._FinishTypewriter()}set characterScale(l){b.RequireFiniteNumber(l);c.get(this)._SetScale(l)}get characterScale(){return c.get(this)._GetScale()}set characterSpacing(l){b.RequireFiniteNumber(l);c.get(this)._SetCharacterSpacing(l)}get characterSpacing(){return c.get(this)._GetCharacterSpacing()}set lineHeight(l){b.RequireFiniteNumber(l);
c.get(this)._SetLineHeight(l)}get lineHeight(){return c.get(this)._GetLineHeight()}set horizontalAlign(l){b.RequireString(l);l=f.get(l);if("undefined"===typeof l)throw Error("invalid mode");c.get(this)._SetHAlign(l)}get horizontalAlign(){return a[c.get(this)._GetHAlign()]}set verticalAlign(l){b.RequireString(l);l=h.get(l);if("undefined"===typeof l)throw Error("invalid mode");c.get(this)._SetVAlign(l)}get verticalAlign(){return d[c.get(this)._GetVAlign()]}set wordWrapMode(l){b.RequireString(l);l=g.get(l);
if("undefined"===typeof l)throw Error("invalid mode");c.get(this)._SetWrapByWord(l)}get wordWrapMode(){return c.get(this)._IsWrapByWord()?"word":"character"}}}{"use strict";const e=self.C3;e.Plugins.Spritefont2.Cnds={CompareText(b,a){return a?this._text===b:e.equalsNoCase(this._text,b)},IsRunningTypewriterText(){return-1!==this._typewriterEndTime},OnTypewriterTextFinished(){return!0}}}"use strict";
self.C3.Plugins.Spritefont2.Acts={SetText(e){this._CancelTypewriter();"number"===typeof e&&1E9>e&&(e=Math.round(1E10*e)/1E10);this._SetText(e.toString())},AppendText(e){this._CancelTypewriter();"number"===typeof e&&1E9>e&&(e=Math.round(1E10*e)/1E10);(e=e.toString())&&this._SetText(this._text+e)},TypewriterText(e,b){this._CancelTypewriter();"number"===typeof e&&1E9>e&&(e=Math.round(1E10*e)/1E10);this._StartTypewriter(e.toString(),b)},TypewriterFinish(){this._FinishTypewriter()},SetScale(e){this._SetScale(e)},
SetCharacterSpacing(e){this._SetCharacterSpacing(e)},SetLineHeight(e){this._SetLineHeight(e)},SetCharacterWidth(e,b){let a=!1;const d=this._sdkType.GetSpriteFont();for(const c of e)if(" "===c)d.SetSpaceWidth(b),a=!0;else if(e=d.GetCharacter(c))e.SetDisplayWidth(b),a=!0;a&&d.SetCharacterWidthsChanged();this._runtime.UpdateRender()},SetEffect(e){this.GetWorldInfo().SetBlendMode(e);this._runtime.UpdateRender()},SetHAlign(e){this._SetHAlign(e)},SetVAlign(e){this._SetVAlign(e)},SetWrapping(e){this._SetWrapByWord(0===
e)}};
{"use strict";const e=self.C3;e.Plugins.Spritefont2.Exps={CharacterWidth(b){return(b=this._sdkType.GetSpriteFont().GetCharacter(b))?b.GetDisplayWidth():this._sdkType.GetSpriteFont().GetCharacterWidth()},CharacterHeight(){return this._characterHeight},CharacterScale(){return this._characterScale},CharacterSpacing(){return this._characterSpacing},LineHeight(){return this._lineHeight},Text(){return this._text},PlainText(){return this._enableBBcode?e.BBString.StripAnyTags(this._text):this._text},TextWidth(){const b=
this.GetWorldInfo();this._spriteFontText.SetSize(b.GetWidth(),b.GetHeight());return this._spriteFontText.GetTextWidth()},TextHeight(){const b=this.GetWorldInfo();this._spriteFontText.SetSize(b.GetWidth(),b.GetHeight());return this._spriteFontText.GetTextHeight()}}}
{"use strict";const e=self.C3;self.SpriteFontCharacter=class{constructor(b,a,d,c){let f=b.GetCharacterWidth(),h=b.GetCharacterHeight();this._spriteFont=b;this._char=a;this._pxRect=new e.Rect(d,c,d+f,c+h);this._texRect=new e.Rect;this._displayWidth=-1;this._UpdateTexRect()}Release(){this._texRect=this._pxRect=this._spriteFont=null}_UpdateTexRect(){let b=this._spriteFont.GetWidth(),a=this._spriteFont.GetHeight();this._texRect.copy(this._pxRect);this._texRect.divide(b,a);this._texRect.lerpInto(this._spriteFont.GetTexRect())}GetSpriteFont(){return this._spriteFont}GetChar(){return this._char}GetTexRect(){return this._texRect}SetDisplayWidth(b){this._displayWidth=
b}GetDisplayWidth(){return 0>this._displayWidth?this._spriteFont.GetCharacterWidth():this._displayWidth}}}
{"use strict";const e=self.C3,b=new e.Rect,a=new e.Quad,d=new e.Color,c=new Set(["left","center","right"]),f=new Set(["top","center","bottom"]),h=new Set(["word","character"]);self.SpriteFontText=class{constructor(g){this._spriteFont=g;this._cssHeight=this._cssWidth=0;this._text="";this._isBBcodeEnabled=!1;this._bbString=null;this._wrappedText=e.New(e.WordWrap);this._wrapMode="word";this._wrapChanged=!1;this._horizontalAlign="left";this._verticalAlign="top";this._sceneGraphScale=this._scale=1;this._lineHeight=
this._spacing=0;this._color=e.New(e.Color);this._drawMaxCharCount=-1;this._drawCharCount=0;this._measureTextCallback=(l,m)=>this._MeasureText(l,m);this._spriteFont._AddSpriteFontText(this)}Release(){this._spriteFont._RemoveSpriteFontText(this);this._measureTextCallback=this._color=null;this._wrappedText.Clear();this._bbString=this._spriteFont=this._wrappedText=null}_MeasureText(g,l){var m=this._GetStyleTag(l,"scale"),u=(m?parseFloat(m.param):this._scale)*this._sceneGraphScale;m=this._GetStyleTag(l,
"scalex");m=(m?parseFloat(m.param):1)*u;l=this._GetStyleTag(l,"scaley");l=(l?parseFloat(l.param):1)*u;l=this._spriteFont.GetCharacterHeight()*l+this._lineHeight;const w=this.GetSpriteFont();u=w.GetCharacterWidth()*m;const q=this.GetSpacing();if(w.HasAnyCustomWidths()){let p=0,r=0;for(var t of g){g=u;const x=w.GetCharacter(t);x?g=x.GetDisplayWidth()*m:" "===t&&(g=w.GetSpaceWidth()*m);r+=g;++p}return{width:r+p*q,height:l}}t=[...g].length;return{width:u*t+Math.max(t,0)*q,height:l}}_SetWrapChanged(){this._wrapChanged=
!0;this._wrappedText.Clear()}SetSize(g,l){0>=g||0>=l||this._cssWidth===g&&this._cssHeight===l||(this._cssWidth!==g&&this._SetWrapChanged(),this._cssWidth=g,this._cssHeight=l)}SetDrawMaxCharacterCount(g){this._drawMaxCharCount=Math.floor(g)}GetDrawMaxCharacterCount(){return this._drawMaxCharCount}_GetStyleTag(g,l){for(let m=g.length-1;0<=m;--m){const u=g[m];if(u.tag===l)return u}return null}_HasStyleTag(g,l){return!!this._GetStyleTag(g,l)}_MaybeWrapText(){if(this._wrapChanged){!this._isBBcodeEnabled||
this._bbString&&this._bbString.toString()===this._text||(this._bbString=new e.BBString(this._text,{noEscape:!0}));var g=-this.GetSpacing();this._wrappedText.WordWrap(this._isBBcodeEnabled?this._bbString.toFragmentList():this._text,this._measureTextCallback,this._cssWidth,this._wrapMode,g);this._wrapChanged=!1}}Draw(g,l,m,u){this._MaybeWrapText();let w=this._drawCharCount=0;const q=this._lineHeight,t=e.cloneArray(this._wrappedText.GetLines()),p=Math.sin(u);u=Math.cos(u);var r=t.reduce((x,y)=>x+y.height,
0)-q;"center"===this._verticalAlign?w=Math.max(Math.floor(this._cssHeight/2-r/2),0):"bottom"===this._verticalAlign&&(w=Math.floor(this._cssHeight-r));for(let x=0,y=t.length;x<y;++x){r=t[x];const D=r.height;if(0<x&&w>this._cssHeight-(D-q))break;0<=w&&this._DrawLine(g,r,l,m,w,p,u);w+=D}}_DrawLine(g,l,m,u,w,q,t){const p=l.height;let r=0;"center"===this._horizontalAlign?r=Math.max(Math.floor((this._cssWidth-l.width)/2),0):"right"===this._horizontalAlign&&(r=Math.max(Math.floor(this._cssWidth-l.width),
0));for(const x of l.fragments)this._DrawFragment(g,x,m,u,r,w,q,t,p),r+=x.width}_DrawFragment(g,l,m,u,w,q,t,p,r){var x=l.text,y=l.width,D=l.styles;if(-1!==this._drawMaxCharCount){if(this._drawCharCount>=this._drawMaxCharCount)return;this._drawCharCount+x.length>this._drawMaxCharCount&&(x=x.substr(0,this._drawMaxCharCount-this._drawCharCount),y=this._MeasureText(x,D).width);this._drawCharCount+=x.length}var G=this._GetStyleTag(D,"background");if(!(e.IsStringAllWhitespace(x)&&!G||this._HasStyleTag(D,
"hide"))){l=this._GetStyleTag(D,"scale");var A=(l?parseFloat(l.param):this._scale)*this._sceneGraphScale;l=this._GetStyleTag(D,"scalex");l=(l?parseFloat(l.param):1)*A;var F=this._GetStyleTag(D,"scaley");A*=F?parseFloat(F.param):1;A*=this._spriteFont.GetCharacterHeight();q+=r-this._lineHeight-A;r=this._GetStyleTag(D,"offsetx");w+=r?parseFloat(r.param):0;r=this._GetStyleTag(D,"offsety");q+=r?parseFloat(r.param):0;G&&(g.SetColorFillMode(),d.parseString(G.param),d.setA(1),g.SetColor(d),b.set(w,q,w+y,
q+A),b.getRight()>this._cssWidth&&b.setRight(this._cssWidth),a.setFromRotatedRectPrecalc(b,t,p),a.offset(m,u),g.Quad(a),g.SetTextureFillMode());(y=this._GetStyleTag(D,"color"))?(d.parseString(y.param),d.setA(this._color.getA())):d.copy(this._color);(y=this._GetStyleTag(D,"opacity"))&&d.setA(d.getA()*parseFloat(y.param)/100);d.premultiply();g.SetColor(d);y=this._spriteFont.GetCharacterWidth()*l;D=Math.abs(this.GetSpacing());for(const J of x)if(x=this._spriteFont.GetCharacter(J)){G=x.GetDisplayWidth()*
l;if(w+G>this._cssWidth+D+1E-5)break;b.set(w,q,w+y,q+A);a.setFromRotatedRectPrecalc(b,t,p);a.offset(m,u);g.Quad3(a,x.GetTexRect());w+=G+this._spacing}else w+=this._spriteFont.GetSpaceWidth()*l+this._spacing}}GetSpriteFont(){return this._spriteFont}SetBBCodeEnabled(g){g=!!g;this._isBBcodeEnabled!==g&&(this._isBBcodeEnabled=g,this._SetWrapChanged())}IsBBCodeEnabled(){return this._isBBcodeEnabled}SetText(g){this._text!==g&&(this._text=g,this._SetWrapChanged())}SetWordWrapMode(g){if(!h.has(g))throw Error("invalid word wrap mode");
this._wrapMode!==g&&(this._wrapMode=g,this._SetWrapChanged())}SetHorizontalAlign(g){if(!c.has(g))throw Error("invalid alignment");this._horizontalAlign=g}SetVerticalAlign(g){if(!f.has(g))throw Error("invalid alignment");this._verticalAlign=g}SetScale(g){this._scale!==g&&(this._scale=g,this._SetWrapChanged())}GetScale(){return this._scale}SetSceneGraphScale(g){this._sceneGraphScale!==g&&(this._sceneGraphScale=g,this._SetWrapChanged())}GetSceneGraphScale(){return this._sceneGraphScale}SetSpacing(g){this._spacing!==
g&&(this._spacing=g,this._SetWrapChanged())}GetSpacing(){return this._spacing}SetLineHeight(g){this._lineHeight=g;this._SetWrapChanged()}GetLineHeight(){return this._lineHeight}SetOpacity(g){g=e.clamp(g,0,1);this._color.a=g}SetColor(g){this._color.equals(g)||this._color.copy(g)}GetColor(){return this._color}GetTextWidth(){this._MaybeWrapText();return this._wrappedText.GetMaxLineWidth()}GetTextHeight(){this._MaybeWrapText();var g=this._spriteFont.GetCharacterHeight()*this._scale;const l=this._lineHeight;
g+=l;return this._wrappedText.GetLineCount()*g-l}}}
{"use strict";const e=self.C3,b={width:256,height:256,characterWidth:16,characterHeight:16,characterSet:""};self.SpriteFont=class{constructor(a){a=Object.assign({},b,a);if(0>=a.width||0>=a.height||0>=a.characterWidth||0>=a.characterHeight)throw Error("invalid size");this._width=a.width;this._height=a.height;this._characterWidth=a.characterWidth;this._characterHeight=a.characterHeight;this._characterSet=a.characterSet;this._spacingData="";this._spacingParsed=null;this._hasAnyCustomWidths=!1;this._spaceWidth=
-1;this._texRect=new e.Rect(0,0,1,1);this._characterMap=new Map;this._mapChanged=!0;this._allTexts=new Set}Release(){this._texRect=null;this._ReleaseCharacters();this._characterMap=null;this._allTexts&&this._allTexts.clear();this._allTexts=null}_ReleaseCharacters(){for(let a of this._characterMap.values())a.Release();this._characterMap.clear()}_AddSpriteFontText(a){this._allTexts.add(a)}_RemoveSpriteFontText(a){this._allTexts.delete(a)}UpdateCharacterMap(){if(this._mapChanged){this._ReleaseCharacters();
var a=[...this._characterSet],d=Math.floor(this._width/this._characterWidth),c=d*Math.floor(this._height/this._characterHeight);for(let f=0,h=a.length;f<h&&!(f>=c);++f){let g=a[f];this._characterMap.set(g,e.New(self.SpriteFontCharacter,this,g,f%d*this._characterWidth,Math.floor(f/d)*this._characterHeight))}this._hasAnyCustomWidths=!1;this._spaceWidth=-1;if(Array.isArray(this._spacingParsed))for(let f of this._spacingParsed)if(Array.isArray(f)&&2===f.length&&(a=f[0],d=f[1],"number"===typeof a&&isFinite(a)&&
"string"===typeof d&&a!==this._characterWidth))for(let h of d)(d=this._characterMap.get(h))?(d.SetDisplayWidth(a),this._hasAnyCustomWidths=!0):" "===h&&(this._spaceWidth=a,this._hasAnyCustomWidths=!0);this._mapChanged=!1;for(let f of this._allTexts)f._SetWrapChanged()}}SetCharacterWidthsChanged(){this._hasAnyCustomWidths=!0;for(const a of this._allTexts)a._SetWrapChanged()}GetCharacter(a){this.UpdateCharacterMap();return this._characterMap.get(a)||null}HasAnyCustomWidths(){return this._hasAnyCustomWidths}SetWidth(a){a=
Math.floor(a);if(0>=a)throw Error("invalid size");this._width!==a&&(this._width=a,this._mapChanged=!0)}GetWidth(){return this._width}SetHeight(a){a=Math.floor(a);if(0>=a)throw Error("invalid size");this._height!==a&&(this._height=a,this._mapChanged=!0)}GetHeight(){return this._height}SetTexRect(a){if(!this._texRect.equals(a)){this._texRect.copy(a);for(const d of this._characterMap.values())d._UpdateTexRect()}}GetTexRect(){return this._texRect}SetCharacterWidth(a){a=Math.floor(a);if(0>=a)throw Error("invalid size");
this._characterWidth!==a&&(this._characterWidth=a,this._mapChanged=!0)}GetCharacterWidth(){return this._characterWidth}SetCharacterHeight(a){a=Math.floor(a);if(0>=a)throw Error("invalid size");this._characterHeight!==a&&(this._characterHeight=a,this._mapChanged=!0)}GetCharacterHeight(){return this._characterHeight}SetCharacterSet(a){this._characterSet!==a&&(this._characterSet=a,this._mapChanged=!0)}GetCharacterSet(){return this._characterSet}SetSpacingData(a){if(this._spacingData!==a&&(this._spacingData=
a,this._mapChanged=!0,this._spacingParsed=null,this._spacingData.length))try{this._spacingParsed=JSON.parse(this._spacingData)}catch(d){this._spacingParsed=null}}GetSpacingData(){return this._spacingData}SetSpaceWidth(a){0>a&&(a=-1);this._spaceWidth!==a&&(this._spaceWidth=a,0<=this._spaceWidth&&(this._hasAnyCustomWidths=!0))}GetSpaceWidth(){return 0>this._spaceWidth?this._characterWidth:this._spaceWidth}}}{"use strict";const e=self.C3;e.Plugins.Audio=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Plugins.Audio.Type=class extends e.SDKTypeBase{constructor(a){super(a)}Release(){super.Release()}OnCreate(){}GetScriptInterfaceClass(){return self.IAudioObjectType}};function b(){if(self.C3Audio_DOMInterface)return self.C3Audio_DOMInterface;throw Error("audio scripting API cannot be used here - make sure the project is using DOM mode, not worker mode");}self.IAudioObjectType=class extends self.IObjectClass{constructor(a){super(a)}get audioContext(){return b().GetAudioContext()}get destinationNode(){return b().GetDestinationNode()}}}
{"use strict";const e=self.C3,b=["interactive","balanced","playback"];e.Plugins.Audio.Instance=class extends e.SDKInstanceBase{constructor(a,d){super(a,"audio");this._nextPlayTime=0;this._triggerTag="";this._saveLoadMode=this._timeScaleMode=0;this._playInBackground=!1;this._distanceModel=this._panningModel=1;this._listenerX=this._runtime.GetViewportWidth()/2;this._listenerY=this._runtime.GetViewportHeight()/2;this._listenerZ=-600;this._referenceDistance=600;this._maxDistance=1E4;this._rolloffFactor=
1;this._listenerInst=null;this._loadListenerUid=-1;this._masterVolume=1;this._isSilent=!1;this._sampleRate=0;this._effectCount=new Map;this._preloadCount=this._preloadTotal=0;this._remoteUrls=new Map;a="interactive";d&&(this._timeScaleMode=d[0],this._saveLoadMode=d[1],this._playInBackground=d[2],a=b[d[3]],this._panningModel=d[4],this._distanceModel=d[5],this._listenerZ=-d[6],this._referenceDistance=d[7],this._maxDistance=d[8],this._rolloffFactor=d[9]);this._lastAIState=[];this._lastFxState=[];this._lastAnalysersData=
[];this.AddDOMMessageHandlers([["state",c=>this._OnUpdateState(c)],["fxstate",c=>this._OnUpdateFxState(c)],["trigger",c=>this._OnTrigger(c)]]);d=this.GetRuntime().Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(d,"instancedestroy",c=>this._OnInstanceDestroyed(c.instance)),e.Disposable.From(d,"afterload",()=>this._OnAfterLoad()),e.Disposable.From(d,"suspend",()=>this._OnSuspend()),e.Disposable.From(d,"resume",()=>this._OnResume()));this._runtime.AddLoadPromise(this.PostToDOMAsync("create-audio-context",
{preloadList:this._runtime.GetAssetManager().GetAudioToPreload().map(c=>({originalUrl:c.originalUrl,url:c.url,type:c.type,fileSize:c.fileSize})),isiOSCordova:this._runtime.IsiOSCordova(),timeScaleMode:this._timeScaleMode,latencyHint:a,panningModel:this._panningModel,distanceModel:this._distanceModel,refDistance:this._referenceDistance,maxDistance:this._maxDistance,rolloffFactor:this._rolloffFactor,listenerPos:[this._listenerX,this._listenerY,this._listenerZ]}).then(c=>{this._sampleRate=c.sampleRate}));
this._StartTicking()}Release(){this._listenerInst=null;super.Release()}_OnInstanceDestroyed(a){this._listenerInst===a&&(this._listenerInst=null)}DbToLinearNoCap(a){return Math.pow(10,a/20)}DbToLinear(a){a=this.DbToLinearNoCap(a);return isFinite(a)?Math.max(Math.min(a,1),0):0}LinearToDbNoCap(a){return Math.log(a)/Math.log(10)*20}LinearToDb(a){return this.LinearToDbNoCap(Math.max(Math.min(a,1),0))}_OnSuspend(){this._playInBackground||this.PostToDOM("set-suspended",{isSuspended:!0})}_OnResume(){this._playInBackground||
this.PostToDOM("set-suspended",{isSuspended:!1})}_OnUpdateState(a){const d=a.tickCount,c=this._lastAIState.filter(f=>f.hasOwnProperty("placeholder")&&(f.placeholder>d||-1===f.placeholder));this._lastAIState=a.audioInstances;this._lastAnalysersData=a.analysers;0<c.length&&e.appendArray(this._lastAIState,c)}_OnUpdateFxState(a){this._lastFxState=a.fxstate}_GetFirstAudioStateByTag(a){for(const d of this._lastAIState)if(e.equalsNoCase(d.tag,a))return d;return null}_IsTagPlaying(a){return this._lastAIState.some(d=>
e.equalsNoCase(a,d.tag)&&d.isPlaying)}_MaybeMarkAsPlaying(a,d,c,f){if(this._IsTagPlaying(a))return null;a={tag:a,duration:0,volume:f,isPlaying:!0,playbackTime:0,playbackRate:1,uid:-1,bufferOriginalUrl:"",bufferUrl:"",bufferType:"",isMusic:d,isLooping:c,isMuted:!1,resumePosition:0,pan:null,placeholder:-1};this._lastAIState.push(a);return a}async _OnTrigger(a){const d=a.type;this._triggerTag=a.tag;a=a.aiid;if("ended"===d){for(const c of this._lastAIState)if(c.aiid===a){c.isPlaying=!1;break}await this.TriggerAsync(e.Plugins.Audio.Cnds.OnEnded)}else"fade-ended"===
d&&await this.TriggerAsync(e.Plugins.Audio.Cnds.OnFadeEnded)}Tick(){const a={timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTimeRaw(),instPans:this.GetInstancePans(),tickCount:this._runtime.GetTickCountNoSave()};if(this._listenerInst){const d=this._listenerInst.GetWorldInfo();this._listenerX=d.GetX();this._listenerY=d.GetY();a.listenerPos=[this._listenerX,this._listenerY,this._listenerZ]}this.PostToDOM("tick",a)}rotatePtAround(a,d,c,f,h){if(0===c)return[a,d];const g=Math.sin(c);
c=Math.cos(c);a-=f;d-=h;const l=a*g;a=a*c-d*g;return[a+f,d*c+l+h]}GetInstancePans(){return this._lastAIState.filter(a=>-1!==a.uid).map(a=>this._runtime.GetInstanceByUID(a.uid)).filter(a=>a).map(a=>{const d=a.GetWorldInfo(),c=d.GetLayer().GetAngle(),[f,h]=this.rotatePtAround(d.GetX(),d.GetY(),-c,this._listenerX,this._listenerY);return{uid:a.GetUID(),x:f,y:h,angle:d.GetAngle()-c}})}GetAnalyserData(a,d){for(const c of this._lastAnalysersData)if(c.index===d&&e.equalsNoCase(c.tag,a))return c;return null}_IncrementEffectCount(a){this._effectCount.set(a,
(this._effectCount.get(a)||0)+1)}_ShouldSave(a){return a.hasOwnProperty("placeholder")||3===this._saveLoadMode?!1:a.isMusic&&1===this._saveLoadMode?!1:a.isMusic||2!==this._saveLoadMode?!0:!1}SaveToJson(){return{isSilent:this._isSilent,masterVolume:this._masterVolume,listenerZ:this._listenerZ,listenerUid:this._listenerInst?this._listenerInst.GetUID():-1,remoteUrls:[...this._remoteUrls.entries()],playing:this._lastAIState.filter(a=>this._ShouldSave(a)),effects:this._lastFxState,analysers:this._lastAnalysersData}}LoadFromJson(a){this._isSilent=
a.isSilent;this._masterVolume=a.masterVolume;this._listenerZ=a.listenerZ;this._listenerInst=null;this._loadListenerUid=a.listenerUid;this._remoteUrls.clear();if(a.remoteUrls)for(const [d,c]of a.remoteUrls)this._remoteUrls.set(d,c);this._lastAIState=a.playing;this._lastFxState=a.effects;this._lastAnalysersData=a.analysers}_OnAfterLoad(){if(-1!==this._loadListenerUid&&(this._listenerInst=this._runtime.GetInstanceByUID(this._loadListenerUid),this._loadListenerUid=-1,this._listenerInst)){var a=this._listenerInst.GetWorldInfo();
this._listenerX=a.GetX();this._listenerY=a.GetY()}for(var d of this._lastAIState)(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d.bufferOriginalUrl))?(d.bufferUrl=a.url,d.bufferType=a.type):d.bufferUrl=null;for(const c of Object.values(this._lastFxState))for(const f of c)f.hasOwnProperty("bufferOriginalUrl")&&(d=this._runtime.GetAssetManager().GetProjectAudioFileUrl(f.bufferOriginalUrl))&&(f.bufferUrl=d.url,f.bufferType=d.type);this.PostToDOM("load-state",{saveLoadMode:this._saveLoadMode,
timeScale:this._runtime.GetTimeScale(),gameTime:this._runtime.GetGameTimeRaw(),listenerPos:[this._listenerX,this._listenerY,this._listenerZ],isSilent:this._isSilent,masterVolume:this._masterVolume,playing:this._lastAIState.filter(c=>null!==c.bufferUrl),effects:this._lastFxState})}GetDebuggerProperties(){const a=[];for(const [d,c]of Object.entries(this._lastFxState))a.push({name:"$"+d,value:c.map(f=>f.type).join(", ")});return[{title:"plugins.audio.debugger.tag-effects",properties:a},{title:"plugins.audio.debugger.currently-playing",
properties:[{name:"plugins.audio.debugger.currently-playing-count",value:this._lastAIState.length},...this._lastAIState.map((d,c)=>({name:"$#"+c,value:`${d.bufferOriginalUrl} ("${d.tag}") ${Math.round(10*d.playbackTime)/10} / ${Math.round(10*d.duration)/10}`}))]}]}}}
{"use strict";const e=self.C3;e.Plugins.Audio.Cnds={OnEnded(b){return e.equalsNoCase(this._triggerTag,b)},OnFadeEnded(b){return e.equalsNoCase(this._triggerTag,b)},PreloadsComplete(){return this._preloadCount===this._preloadTotal},AdvancedAudioSupported(){return!0},IsSilent(){return this._isSilent},IsAnyPlaying(){for(const b of this._lastAIState)if(b.isPlaying)return!0;return!1},IsTagPlaying(b){return this._IsTagPlaying(b)}}}
{"use strict";const e=self.C3,b="lowpass highpass bandpass lowshelf highshelf peaking notch allpass".split(" ");e.Plugins.Audio.Acts={async Play(a,d,c,f,h){if(!this._isSilent){var g=a[1],l=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(l){h=h?h:0;var m=this._nextPlayTime;this._nextPlayTime=0;var u=this._MaybeMarkAsPlaying(f.toLowerCase(),g,0!==d,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:l.url,type:l.type,isMusic:g,tag:f.toLowerCase(),isLooping:0!==
d,vol:this.DbToLinear(c),pos:h,off:m,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{u&&(u.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPosition(a,d,c,f,h,g,l,m,u,w){if(!this._isSilent){var q=a[1],t=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(t){var p=this._nextPlayTime;this._nextPlayTime=0;var r=this._MaybeMarkAsPlaying(w.toLowerCase(),q,0!==d,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:t.url,type:t.type,isMusic:q,
tag:w.toLowerCase(),isLooping:0!==d,vol:this.DbToLinear(c),pos:0,off:p,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:f,y:h,angle:e.toRadians(g),innerAngle:e.toRadians(l),outerAngle:e.toRadians(m),outerGain:this.DbToLinear(u)}})}finally{r&&(r.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObject(a,d,c,f,h,g,l,m){if(!this._isSilent&&f&&(f=f.GetFirstPicked())&&f.GetWorldInfo()){var u=f.GetWorldInfo(),w=u.GetLayer().GetAngle(),[q,t]=this.rotatePtAround(u.GetX(),u.GetY(),-w,
this._listenerX,this._listenerY),p=a[1],r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);if(r){var x=this._nextPlayTime;this._nextPlayTime=0;var y=this._MaybeMarkAsPlaying(m.toLowerCase(),p,0!==d,this.DbToLinear(c));try{await this.PostToDOMAsync("play",{originalUrl:a[0],url:r.url,type:r.type,isMusic:p,tag:m.toLowerCase(),isLooping:0!==d,vol:this.DbToLinear(c),pos:0,off:x,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:q,y:t,angle:u.GetAngle()-w,innerAngle:e.toRadians(h),outerAngle:e.toRadians(g),
outerGain:this.DbToLinear(l),uid:f.GetUID()}})}finally{y&&(y.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayByName(a,d,c,f,h){if(!this._isSilent){a=1===a;var g=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase());if(g){var l=this._nextPlayTime;this._nextPlayTime=0;var m=this._MaybeMarkAsPlaying(h.toLowerCase(),a,0!==c,this.DbToLinear(f));try{await this.PostToDOMAsync("play",{originalUrl:d,url:g.url,type:g.type,isMusic:a,tag:h.toLowerCase(),
isLooping:0!==c,vol:this.DbToLinear(f),pos:0,off:l,trueClock:!!self.C3_GetAudioContextCurrentTime})}finally{m&&(m.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtPositionByName(a,d,c,f,h,g,l,m,u,w,q){if(!this._isSilent){a=1===a;var t=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase());if(t){var p=this._nextPlayTime;this._nextPlayTime=0;var r=this._MaybeMarkAsPlaying(q.toLowerCase(),a,0!==c,this.DbToLinear(f));try{await this.PostToDOMAsync("play",
{originalUrl:d,url:t.url,type:t.type,isMusic:a,tag:q.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(f),pos:0,off:p,trueClock:!!self.C3_GetAudioContextCurrentTime,panning:{x:h,y:g,angle:e.toRadians(l),innerAngle:e.toRadians(m),outerAngle:e.toRadians(u),outerGain:this.DbToLinear(w)}})}finally{r&&(r.placeholder=this._runtime.GetTickCountNoSave())}}}},async PlayAtObjectByName(a,d,c,f,h,g,l,m,u){if(!this._isSilent&&!this._isSilent&&h&&(h=h.GetFirstPicked())&&h.GetWorldInfo()){var w=h.GetWorldInfo(),
q=w.GetLayer().GetAngle(),[t,p]=this.rotatePtAround(w.GetX(),w.GetY(),-q,this._listenerX,this._listenerY);a=1===a;var r=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase());if(r){var x=this._nextPlayTime;this._nextPlayTime=0;var y=this._MaybeMarkAsPlaying(u.toLowerCase(),a,0!==c,this.DbToLinear(f));try{await this.PostToDOMAsync("play",{originalUrl:d,url:r.url,type:r.type,isMusic:a,tag:u.toLowerCase(),isLooping:0!==c,vol:this.DbToLinear(f),pos:0,off:x,trueClock:!!self.C3_GetAudioContextCurrentTime,
panning:{x:t,y:p,angle:w.GetAngle()-q,innerAngle:e.toRadians(g),outerAngle:e.toRadians(l),outerGain:this.DbToLinear(m),uid:h.GetUID()}})}finally{y&&(y.placeholder=this._runtime.GetTickCountNoSave())}}}},SetLooping(a,d){this.PostToDOM("set-looping",{tag:a.toLowerCase(),isLooping:0===d})},SetMuted(a,d){this.PostToDOM("set-muted",{tag:a.toLowerCase(),isMuted:0===d})},SetVolume(a,d){this.PostToDOM("set-volume",{tag:a.toLowerCase(),vol:this.DbToLinear(d)})},FadeVolume(a,d,c,f){this.PostToDOM("fade-volume",
{tag:a.toLowerCase(),vol:this.DbToLinear(d),duration:c,stopOnEnd:0===f})},async Preload(a){const d=a[1],c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]);c&&(this._preloadTotal++,await this.PostToDOMAsync("preload",{originalUrl:a[0],url:c.url,type:c.type,isMusic:d}),this._preloadCount++)},async PreloadByName(a,d){a=1===a;const c=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase());c&&(this._preloadTotal++,await this.PostToDOMAsync("preload",
{originalUrl:d,url:c.url,type:c.type,isMusic:a}),this._preloadCount++)},SetPlaybackRate(a,d){this.PostToDOM("set-playback-rate",{tag:a.toLowerCase(),rate:Math.max(d,0)})},Stop(a){this.PostToDOM("stop",{tag:a.toLowerCase()})},StopAll(){this.PostToDOM("stop-all")},SetPaused(a,d){this.PostToDOM("set-paused",{tag:a.toLowerCase(),paused:0===d})},Seek(a,d){this.PostToDOM("seek",{tag:a.toLowerCase(),pos:d})},SetSilent(a){2===a&&(a=this._isSilent?1:0);a=0===a;this._isSilent!==a&&(this._isSilent=a,this.PostToDOM("set-silent",
{isSilent:a}))},SetMasterVolume(a){a=this.DbToLinear(a);this._masterVolume!==a&&(this._masterVolume=a,this.PostToDOM("set-master-volume",{vol:a}))},AddFilterEffect(a,d,c,f,h,g,l){a=a.toLowerCase();d=b[d];this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"filter",tag:a,params:[d,c,f,h,g,e.clamp(l/100,0,1)]})},AddDelayEffect(a,d,c,f){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"delay",tag:a,params:[d,this.DbToLinear(c),e.clamp(f/100,0,1)]})},AddFlangerEffect(a,
d,c,f,h,g){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"flanger",tag:a,params:[d/1E3,c/1E3,f,h/100,e.clamp(g/100,0,1)]})},AddPhaserEffect(a,d,c,f,h,g,l){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"phaser",tag:a,params:[d,c,f,h,g,e.clamp(l/100,0,1)]})},AddConvolutionEffect(a,d,c,f){a=a.toLowerCase();const h=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d[0]);h&&(this._IncrementEffectCount(a),this.PostToDOM("add-effect",
{type:"convolution",tag:a,bufferOriginalUrl:d[0],bufferUrl:h.url,bufferType:h.type,params:[0===c,e.clamp(f/100,0,1)]}))},AddGainEffect(a,d){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[this.DbToLinear(d)]})},AddMuteEffect(a){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"gain",tag:a,params:[0]})},AddTremoloEffect(a,d,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"tremolo",
tag:a,params:[d,e.clamp(c/100,0,1)]})},AddRingModEffect(a,d,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"ringmod",tag:a,params:[d,e.clamp(c/100,0,1)]})},AddDistortionEffect(a,d,c,f,h,g){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"distortion",tag:a,params:[this.DbToLinearNoCap(d),this.DbToLinearNoCap(c),f,this.DbToLinearNoCap(h),e.clamp(g/100,0,1)]})},AddCompressorEffect(a,d,c,f,h,g){a=a.toLowerCase();this._IncrementEffectCount(a);
this.PostToDOM("add-effect",{type:"compressor",tag:a,params:[d,c,f,h/1E3,g/1E3]})},AddAnalyserEffect(a,d,c){a=a.toLowerCase();this._IncrementEffectCount(a);this.PostToDOM("add-effect",{type:"analyser",tag:a,params:[d,c]})},RemoveEffects(a){a=a.toLowerCase();this._effectCount.set(a,0);this.PostToDOM("remove-effects",{tag:a});this._lastFxState={}},SetEffectParameter(a,d,c,f,h,g){this.PostToDOM("set-effect-param",{tag:a.toLowerCase(),index:Math.floor(d),param:c,value:f,ramp:h,time:g})},SetListenerObject(a){a&&
(a=a.GetFirstPicked())&&a.GetWorldInfo()&&(this._listenerInst=a)},SetListenerZ(a){this._listenerZ=a},ScheduleNextPlay(a){this._nextPlayTime=Math.max(a,0)},UnloadAudio(a){const d=a[1];(a=this._runtime.GetAssetManager().GetProjectAudioFileUrl(a[0]))&&this.PostToDOM("unload",{url:a.url,type:a.type,isMusic:d})},UnloadAudioByName(a,d){a=1===a;(d=this._runtime.GetAssetManager().GetProjectAudioFileUrl(d)||this._remoteUrls.get(d.toLowerCase()))&&this.PostToDOM("unload",{url:d.url,type:d.type,isMusic:a})},
UnloadAll(){this.PostToDOM("unload-all")},AddRemoteURL(a,d,c){this._remoteUrls.set(c.toLowerCase(),{url:a,type:d})}}}"use strict";
self.C3.Plugins.Audio.Exps={Duration(e){return(e=this._GetFirstAudioStateByTag(e))?e.duration:0},PlaybackTime(e){return(e=this._GetFirstAudioStateByTag(e))?e.playbackTime:0},PlaybackRate(e){return(e=this._GetFirstAudioStateByTag(e))?e.playbackRate:0},Volume(e){return(e=this._GetFirstAudioStateByTag(e))?this.LinearToDb(e.volume):0},MasterVolume(){return this.LinearToDb(this._masterVolume)},EffectCount(e){return this._effectCount.get(e.toLowerCase())||0},AnalyserFreqBinCount(e,b){return(e=this.GetAnalyserData(e,
Math.floor(b)))?e.binCount:0},AnalyserFreqBinAt(e,b,a){e=this.GetAnalyserData(e,Math.floor(b));if(!e)return 0;a=Math.floor(a);return 0>a||a>=e.binCount?0:e.freqBins[a]},AnalyserPeakLevel(e,b){return(e=this.GetAnalyserData(e,Math.floor(b)))?e.peak:0},AnalyserRMSLevel(e,b){return(e=this.GetAnalyserData(e,Math.floor(b)))?e.rms:0},SampleRate(){return this._sampleRate},CurrentTime(){return self.C3_GetAudioContextCurrentTime?self.C3_GetAudioContextCurrentTime():performance.now()/1E3}};
{"use strict";const e=self.C3;e.Plugins.LocalStorage=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Plugins.LocalStorage.Type=class extends e.SDKTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Plugins.LocalStorage.Instance=class extends e.SDKInstanceBase{constructor(b,a){super(b);this._lastValue=this._currentKey="";this._keyNamesList=[];this._errorMessage="";this._pendingSets=this._pendingGets=0;this._storage=this._runtime._GetProjectStorage();this._debugCache=new Map;this._isLoadingDebugCache=!1}Release(){super.Release()}async _TriggerStorageError(b){this._errorMessage=this._GetErrorString(b);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnError)}_GetErrorString(b){return b?
"string"===typeof b?b:"string"===typeof b.message?b.message:"string"===typeof b.name?b.name:"string"===typeof b.data?b.data:"unknown error":"unknown error"}GetDebuggerProperties(){this._isLoadingDebugCache||this._DebugCacheStorage();return[{title:"plugins.localstorage.name",properties:[...this._debugCache.entries()].map(b=>({name:"$"+b[0],value:b[1],onedit:a=>this._storage.setItem(b[0],a)}))}]}async _DebugCacheStorage(){this._isLoadingDebugCache=!0;try{const b=await this._storage.keys();b.sort((d,
c)=>{d=d.toLowerCase();c=c.toLowerCase();return d<c?-1:c<d?1:0});const a=await Promise.all(b.map(d=>this._storage.getItem(d)));this._debugCache.clear();for(let d=0,c=b.length;d<c;++d)this._debugCache.set(b[d],a[d])}catch(b){console.warn("[C3 debugger] Error displaying local storage: ",b)}finally{this._isLoadingDebugCache=!1}}}}
{"use strict";const e=self.C3;e.Plugins.LocalStorage.Cnds={OnItemSet(b){return this._currentKey===b},OnAnyItemSet(){return!0},OnItemGet(b){return this._currentKey===b},OnAnyItemGet(){return!0},OnItemRemoved(b){return this._currentKey===b},OnAnyItemRemoved(){return!0},OnCleared(){return!0},OnAllKeyNamesLoaded(){return!0},OnError(){return!0},OnItemExists(b){return this._currentKey===b},OnItemMissing(b){return this._currentKey===b},CompareKey(b,a){return e.compare(this._currentKey,b,a)},CompareValue(b,
a){return e.compare(this._lastValue,b,a)},IsProcessingSets(){return 0<this._pendingSets},IsProcessingGets(){return 0<this._pendingGets},OnAllSetsComplete(){return!0},OnAllGetsComplete(){return!0}}}
{"use strict";const e=self.C3;function b(a){return"string"===typeof a||"number"===typeof a}e.Plugins.LocalStorage.Acts={async SetItem(a,d){this._pendingSets++;try{const c=await this._storage.setItem(a,d);await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue=c;await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(c){await this._TriggerStorageError(c)}finally{this._pendingSets--,0===this._pendingSets&&
await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}},async SetBinaryItem(a,d){if(d&&(d=d.GetFirstPicked(this._inst))&&(d=d.GetSdkInstance())){d=d.GetArrayBufferReadOnly();this._pendingSets++;try{await this._storage.setItem(a,d),await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue="";await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemSet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemSet)})}catch(c){await this._TriggerStorageError(c)}finally{this._pendingSets--,
0===this._pendingSets&&await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllSetsComplete)}}},async GetItem(a){this._pendingGets++;try{const d=await this._storage.getItem(a);await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue=b(d)?d:"";await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(d){await this._TriggerStorageError(d)}finally{this._pendingGets--,0===this._pendingGets&&await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}},
async GetBinaryItem(a,d){if(d&&(d=d.GetFirstPicked(this._inst))){var c=d.GetSdkInstance();this._pendingGets++;try{let f=await this._storage.getItem(a);f=f instanceof ArrayBuffer?f:new ArrayBuffer(0);await this.ScheduleTriggers(async()=>{this._lastValue="";this._currentKey=a;c.SetArrayBufferTransfer(f);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemGet);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemGet)})}catch(f){await this._TriggerStorageError(f)}finally{this._pendingGets--,
0===this._pendingGets&&await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllGetsComplete)}}},async CheckItemExists(a){try{const d=await this._storage.getItem(a);await this.ScheduleTriggers(async()=>{this._currentKey=a;"undefined"===typeof d||null===d?(this._lastValue="",await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemMissing)):(this._lastValue=b(d)?d:"",await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemExists))})}catch(d){await this._TriggerStorageError(d)}},async RemoveItem(a){try{await this._storage.removeItem(a),
await this.ScheduleTriggers(async()=>{this._currentKey=a;this._lastValue="";await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAnyItemRemoved);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnItemRemoved)})}catch(d){await this._TriggerStorageError(d)}},async ClearStorage(){try{await this._storage.clear(),await this.ScheduleTriggers(async()=>{this._lastValue=this._currentKey="";e.clearArray(this._keyNamesList);await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnCleared)})}catch(a){await this._TriggerStorageError(a)}},
async GetAllKeyNames(){try{const a=await this._storage.keys();await this.ScheduleTriggers(async()=>{this._keyNamesList=a;await this.TriggerAsync(e.Plugins.LocalStorage.Cnds.OnAllKeyNamesLoaded)})}catch(a){await this._TriggerStorageError(a)}}}}"use strict";self.C3.Plugins.LocalStorage.Exps={ItemValue(){return this._lastValue},Key(){return this._currentKey},KeyCount(){return this._keyNamesList.length},KeyAt(e){e=Math.floor(e);return 0>e||e>=this._keyNamesList.length?"":this._keyNamesList[e]},ErrorMessage(){return this._errorMessage}};
{"use strict";const e=self.C3;e.Plugins.TiledBg=class extends e.SDKPluginBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;function b(a){switch(a){case 0:return"clamp-to-edge";case 2:return"mirror-repeat"}return"repeat"}e.Plugins.TiledBg.Type=class extends e.SDKTypeBase{constructor(a,d){super(a);this._wrapY=this._wrapX="repeat";d&&(this._wrapX=b(d[0]),this._wrapY=b(d[1]))}Release(){super.Release()}OnCreate(){this.GetImageInfo().LoadAsset(this._runtime)}LoadTextures(a){return this.GetImageInfo().LoadStaticTexture(a,{sampling:this._runtime.GetSampling(),wrapX:this._wrapX,wrapY:this._wrapY})}ReleaseTextures(){this.GetImageInfo().ReleaseTexture()}}}
{"use strict";const e=self.C3,b=self.C3X,a=e.New(e.Rect),d=e.New(e.Quad),c=e.New(e.Rect),f=e.New(e.Quad);e.Plugins.TiledBg.Instance=class extends e.SDKWorldInstanceBase{constructor(g,l){super(g);this._imageOffsetY=this._imageOffsetX=0;this._imageScaleY=this._imageScaleX=1;this._imageAngle=0;this._ownImageInfo=null;l&&(this.GetWorldInfo().SetVisible(!!l[0]),this._imageOffsetX=l[4],this._imageOffsetY=l[5],this._imageScaleX=l[6],this._imageScaleY=l[7],this._imageAngle=e.toRadians(l[8]))}Release(){this._ReleaseOwnImage();
super.Release()}_ReleaseOwnImage(){this._ownImageInfo&&(this._ownImageInfo.Release(),this._ownImageInfo=null)}CalculateTextureCoordsFor3DFace(g,l,m){var u=this.GetCurrentImageInfo();const w=u.GetWidth();u=u.GetHeight();const q=this._imageOffsetX/w,t=this._imageOffsetY/u,p=this._imageAngle;c.set(0,0,g/(w*this._imageScaleX),l/(u*this._imageScaleY));c.offset(-q,-t);0===p?m.setFromRect(c):m.setFromRotatedRect(c,-p)}Draw(g){var l=this.GetCurrentImageInfo(),m=l.GetTexture();if(null!==m){g.SetTexture(m);
m=l.GetWidth();l=l.GetHeight();var u=this._imageOffsetX/m,w=this._imageOffsetY/l,q=this.GetWorldInfo();c.set(0,0,q.GetWidth()/(m*this._imageScaleX),q.GetHeight()/(l*this._imageScaleY));c.offset(-u,-w);q.HasMesh()?this._DrawMesh(q,g):this._DrawStandard(q,g)}}_DrawStandard(g,l){let m=g.GetBoundingQuad();this._runtime.IsPixelRoundingEnabled()&&(m=g.PixelRoundQuad(m));0===this._imageAngle?l.Quad3(m,c):(f.setFromRotatedRect(c,-this._imageAngle),l.Quad4(m,f))}_DrawMesh(g,l){const m=g.GetTransformedMesh();
if(g.IsMeshChanged()){g.CalculateBbox(a,d,!1);let u=d;this._runtime.IsPixelRoundingEnabled()&&(u=g.PixelRoundQuad(u));let w=c;0!==this._imageAngle&&(f.setFromRotatedRect(c,-this._imageAngle),w=f);m.CalculateTransformedMesh(g.GetSourceMesh(),u,w);g.SetMeshChanged(!1)}m.Draw(l)}GetCurrentImageInfo(){return this._ownImageInfo||this._objectClass.GetImageInfo()}IsOriginalSizeKnown(){return!0}GetTexture(){return this.GetCurrentImageInfo().GetTexture()}_SetMeshChanged(){this.GetWorldInfo().SetMeshChanged(!0)}_SetImageOffsetX(g){this._imageOffsetX!==
g&&(this._imageOffsetX=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageOffsetX(){return this._imageOffsetX}_SetImageOffsetY(g){this._imageOffsetY!==g&&(this._imageOffsetY=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageOffsetY(){return this._imageOffsetY}_SetImageScaleX(g){this._imageScaleX!==g&&(this._imageScaleX=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageScaleX(){return this._imageScaleX}_SetImageScaleY(g){this._imageScaleY!==g&&(this._imageScaleY=
g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageScaleY(){return this._imageScaleY}_SetImageAngle(g){this._imageAngle!==g&&(this._imageAngle=g,this._runtime.UpdateRender(),this._SetMeshChanged())}_GetImageAngle(){return this._imageAngle}GetPropertyValueByIndex(g){switch(g){case 4:return this._GetImageOffsetX();case 5:return this._GetImageOffsetY();case 6:return this._GetImageScaleX();case 7:return this._GetImageScaleY();case 8:return this._GetImageAngle()}}SetPropertyValueByIndex(g,
l){switch(g){case 4:this._SetImageOffsetX(l);break;case 5:this._SetImageOffsetY(l);break;case 6:this._SetImageScaleX(l);break;case 7:this._SetImageScaleY(l);break;case 8:this._SetImageAngle(l)}}GetScriptInterfaceClass(){return self.ITiledBackgroundInstance}};const h=new WeakMap;self.ITiledBackgroundInstance=class extends self.IWorldInstance{constructor(){super();h.set(this,self.IInstance._GetInitInst().GetSdkInstance())}set imageOffsetX(g){b.RequireFiniteNumber(g);h.get(this)._SetImageOffsetX(g)}get imageOffsetX(){return h.get(this)._GetImageOffsetX()}set imageOffsetY(g){b.RequireFiniteNumber(g);
h.get(this)._SetImageOffsetY(g)}get imageOffsetY(){return h.get(this)._GetImageOffsetY()}set imageScaleX(g){b.RequireFiniteNumber(g);h.get(this)._SetImageScaleX(g)}get imageScaleX(){return h.get(this)._GetImageScaleX()}set imageScaleY(g){b.RequireFiniteNumber(g);h.get(this)._SetImageScaleY(g)}get imageScaleY(){return h.get(this)._GetImageScaleY()}set imageAngle(g){b.RequireFiniteNumber(g);h.get(this)._SetImageAngle(g)}get imageAngle(){return h.get(this)._GetImageAngle()}set imageAngleDegrees(g){b.RequireFiniteNumber(g);
h.get(this)._SetImageAngle(e.toRadians(g))}get imageAngleDegrees(){return e.toDegrees(h.get(this)._GetImageAngle())}get imageWidth(){return h.get(this).GetCurrentImageInfo().GetWidth()}get imageHeight(){return h.get(this).GetCurrentImageInfo().GetHeight()}}}"use strict";self.C3.Plugins.TiledBg.Cnds={OnURLLoaded(){return!0},OnURLFailed(){return!0}};
{"use strict";const e=self.C3;e.Plugins.TiledBg.Acts={SetImageOffsetX(b){this._SetImageOffsetX(b)},SetImageOffsetY(b){this._SetImageOffsetY(b)},SetImageScaleX(b){this._SetImageScaleX(b/100)},SetImageScaleY(b){this._SetImageScaleY(b/100)},SetImageAngle(b){this._SetImageAngle(e.toRadians(b))},SetEffect(b){this.GetWorldInfo().SetBlendMode(b);this._runtime.UpdateRender()},async LoadURL(b,a){if(!this._ownImageInfo||this._ownImageInfo.GetURL()!==b){a=this._runtime;var d=e.New(e.ImageInfo);try{await d.LoadDynamicAsset(a,
b);if(!d.IsLoaded())throw Error("image failed to load");if(this.WasReleased())return d.Release(),null;if(!await d.LoadStaticTexture(a.GetRenderer(),{sampling:this._runtime.GetSampling(),wrapX:"repeat",wrapY:"repeat"}))return}catch(c){console.error("Load image from URL failed: ",c);this.Trigger(e.Plugins.TiledBg.Cnds.OnURLFailed);return}this.WasReleased()?d.Release():(this._ReleaseOwnImage(),this._ownImageInfo=d,a.UpdateRender(),await this.TriggerAsync(e.Plugins.TiledBg.Cnds.OnURLLoaded))}}}}
{"use strict";const e=self.C3;e.Plugins.TiledBg.Exps={ImageWidth(){return this.GetCurrentImageInfo().GetWidth()},ImageHeight(){return this.GetCurrentImageInfo().GetHeight()},ImageOffsetX(){return this._imageOffsetX},ImageOffsetY(){return this._imageOffsetY},ImageScaleX(){return 100*this._imageScaleX},ImageScaleY(){return 100*this._imageScaleY},ImageAngle(){return e.toDegrees(this._imageAngle)}}}{"use strict";const e=self.C3;e.Behaviors.Fade=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}
{"use strict";const e=self.C3;e.Behaviors.Fade.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Behaviors.Fade.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._fadeOutTime=this._waitTime=this._fadeInTime=0;this._activeAtStart=this._destroy=!0;this._setMaxOpacity=!1;this._stage=0;this._stageTime=e.New(e.KahanSum);this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()||1;a&&(this._fadeInTime=a[0],this._waitTime=a[1],this._fadeOutTime=a[2],this._destroy=!!a[3],this._stage=(this._activeAtStart=!!a[4])?0:3);this._activeAtStart&&(0===
this._fadeInTime?(this._stage=1,0===this._waitTime&&(this._stage=2)):(this._inst.GetWorldInfo().SetOpacity(0),this._runtime.UpdateRender()));this._StartTicking()}Release(){super.Release()}SaveToJson(){return{fit:this._fadeInTime,wt:this._waitTime,fot:this._fadeOutTime,d:this._destroy,s:this._stage,st:this._stageTime.Get(),mo:this._maxOpacity}}LoadFromJson(b){this._fadeInTime=b.fit;this._waitTime=b.wt;this._fadeOutTime=b.fot;this._destroy=b.d;this._stage=b.s;this._stageTime.Set(b.st);this._maxOpacity=
b.mo}Tick(){var b=this._runtime.GetDt(this._inst);this._stageTime.Add(b);b=this._inst.GetWorldInfo();0===this._stage&&(b.SetOpacity(this._stageTime.Get()/this._fadeInTime*this._maxOpacity),this._runtime.UpdateRender(),b.GetOpacity()>=this._maxOpacity&&(b.SetOpacity(this._maxOpacity),this._stage=1,this._stageTime.Reset(),this.Trigger(e.Behaviors.Fade.Cnds.OnFadeInEnd)));1===this._stage&&this._stageTime.Get()>=this._waitTime&&(this._stage=2,this._stageTime.Reset(),this.Trigger(e.Behaviors.Fade.Cnds.OnWaitEnd));
2===this._stage&&0!==this._fadeOutTime&&(b.SetOpacity(this._maxOpacity-this._stageTime.Get()/this._fadeOutTime*this._maxOpacity),this._runtime.UpdateRender(),0>=b.GetOpacity()&&(this._stage=3,this._stageTime.Reset(),this.Trigger(e.Behaviors.Fade.Cnds.OnFadeOutEnd),this._destroy&&this._runtime.DestroyInstance(this._inst)))}Start(){this._stage=0;this._stageTime.Reset();0===this._fadeInTime?(this._stage=1,0===this._waitTime&&(this._stage=2)):(this._inst.GetWorldInfo().SetOpacity(0),this._runtime.UpdateRender())}GetPropertyValueByIndex(b){switch(b){case 0:return this._fadeInTime;
case 1:return this._waitTime;case 2:return this._fadeOutTime;case 3:return this._destroy}}SetPropertyValueByIndex(b,a){switch(b){case 0:this._fadeInTime=a;break;case 1:this._waitTime=a;break;case 2:this._fadeOutTime=a;break;case 3:this._destroy=!!a}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.fade.properties.fade-in-time.name",value:this._fadeInTime,onedit:b=>this._fadeInTime=b},{name:"behaviors.fade.properties.wait-time.name",value:this._waitTime,
onedit:b=>this._waitTime=b},{name:"behaviors.fade.properties.fade-out-time.name",value:this._fadeOutTime,onedit:b=>this._fadeOutTime=b},{name:"behaviors.fade.debugger.stage",value:["behaviors.fade.debugger."+["fade-in","wait","fade-out","done"][this._stage]]}]}]}}}"use strict";self.C3.Behaviors.Fade.Cnds={OnFadeOutEnd(){return!0},OnFadeInEnd(){return!0},OnWaitEnd(){return!0}};"use strict";
self.C3.Behaviors.Fade.Acts={StartFade(){this._activeAtStart||this._setMaxOpacity||(this._maxOpacity=this._inst.GetWorldInfo().GetOpacity()||1,this._setMaxOpacity=!0);3===this._stage&&this.Start()},RestartFade(){this.Start()},SetFadeInTime(e){0>e&&(e=0);this._fadeInTime=e},SetWaitTime(e){0>e&&(e=0);this._waitTime=e},SetFadeOutTime(e){0>e&&(e=0);this._fadeOutTime=e}};"use strict";self.C3.Behaviors.Fade.Exps={FadeInTime(){return this._fadeInTime},WaitTime(){return this._waitTime},FadeOutTime(){return this._fadeOutTime}};
{"use strict";const e=self.C3;e.Behaviors.Sin=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Sin.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3,b=self.C3X,a=self.IBehaviorInstance,d=2*Math.PI,c=Math.PI/2,f=3*Math.PI/2,h=[0,1,8,3,4,2,5,6,9,7];e.Behaviors.Sin.Instance=class extends e.SDKBehaviorInstanceBase{constructor(u,w){super(u);this._mag=this._period=this._wave=this._movement=this._i=0;this._isEnabled=!0;this._ratio=this._lastKnownValue2=this._lastKnownValue=this._initialValue2=this._initialValue=this._magnitudeRandom=this._periodOffsetRandom=this._periodRandom=this._baseMag=this._basePeriodOffset=this._basePeriod=
0;w&&(this._movement=h[w[0]],this._wave=w[1],this._periodRandom=this._runtime.Random()*w[3],this._basePeriod=w[2],this._period=w[2],this._period+=this._periodRandom,this._basePeriodOffset=w[4],0!==this._period&&(this._periodOffsetRandom=this._runtime.Random()*w[5],this._i=w[4]/this._period*d,this._i+=this._periodOffsetRandom/this._period*d),this._magnitudeRandom=this._runtime.Random()*w[7],this._baseMag=w[6],this._mag=w[6],this._mag+=this._magnitudeRandom,this._isEnabled=!!w[8]);5===this._movement&&
(this._mag=e.toRadians(this._mag));this.Init();this._isEnabled&&this._StartTicking()}Release(){super.Release()}SaveToJson(){return{i:this._i,e:this._isEnabled,mv:this._movement,w:this._wave,p:this._period,mag:this._mag,iv:this._initialValue,iv2:this._initialValue2,r:this._ratio,lkv:this._lastKnownValue,lkv2:this._lastKnownValue2}}LoadFromJson(u){this._i=u.i;this._SetEnabled(u.e);this._movement=u.mv;this._wave=u.w;this._period=u.p;this._mag=u.mag;this._initialValue=u.iv;this._initialValue2=u.iv2;this._ratio=
u.r;this._lastKnownValue=u.lkv;this._lastKnownValue2=u.lkv2}Init(){const u=this._inst.GetWorldInfo();switch(this._movement){case 0:this._initialValue=u.GetX();break;case 1:this._initialValue=u.GetY();break;case 2:this._initialValue=u.GetWidth();this._ratio=u.GetHeight()/u.GetWidth();break;case 3:this._initialValue=u.GetWidth();break;case 4:this._initialValue=u.GetHeight();break;case 5:this._initialValue=u.GetAngle();break;case 6:this._initialValue=u.GetOpacity();break;case 7:this._initialValue=0;
break;case 8:this._initialValue=u.GetX();this._initialValue2=u.GetY();break;case 9:this._initialValue=u.GetZElevation()}this._lastKnownValue=this._initialValue;this._lastKnownValue2=this._initialValue2}WaveFunc(u){u%=d;switch(this._wave){case 0:return Math.sin(u);case 1:return u<=c?u/c:u<=f?1-2*(u-c)/Math.PI:(u-f)/c-1;case 2:return 2*u/d-1;case 3:return-2*u/d+1;case 4:return u<Math.PI?-1:1}return 0}Tick(){const u=this._runtime.GetDt(this._inst);this._isEnabled&&0!==u&&(this._i=0===this._period?0:
(this._i+u/this._period*d)%d,this._UpdateFromPhase())}_UpdateFromPhase(){const u=this._inst.GetWorldInfo();switch(this._movement){case 0:u.GetX()!==this._lastKnownValue&&(this._initialValue+=u.GetX()-this._lastKnownValue);u.SetX(this._initialValue+this.WaveFunc(this._i)*this._mag);this._lastKnownValue=u.GetX();break;case 1:u.GetY()!==this._lastKnownValue&&(this._initialValue+=u.GetY()-this._lastKnownValue);u.SetY(this._initialValue+this.WaveFunc(this._i)*this._mag);this._lastKnownValue=u.GetY();break;
case 2:u.SetWidth(this._initialValue+this.WaveFunc(this._i)*this._mag);u.SetHeight(u.GetWidth()*this._ratio);break;case 3:u.SetWidth(this._initialValue+this.WaveFunc(this._i)*this._mag);break;case 4:u.SetHeight(this._initialValue+this.WaveFunc(this._i)*this._mag);break;case 5:u.GetAngle()!==this._lastKnownValue&&(this._initialValue=e.clampAngle(this._initialValue+(u.GetAngle()-this._lastKnownValue)));u.SetAngle(this._initialValue+this.WaveFunc(this._i)*this._mag);this._lastKnownValue=u.GetAngle();
break;case 6:u.SetOpacity(this._initialValue+this.WaveFunc(this._i)*this._mag/100);break;case 8:u.GetX()!==this._lastKnownValue&&(this._initialValue+=u.GetX()-this._lastKnownValue);u.GetY()!==this._lastKnownValue2&&(this._initialValue2+=u.GetY()-this._lastKnownValue2);u.SetX(this._initialValue+Math.cos(u.GetAngle())*this.WaveFunc(this._i)*this._mag);u.SetY(this._initialValue2+Math.sin(u.GetAngle())*this.WaveFunc(this._i)*this._mag);this._lastKnownValue=u.GetX();this._lastKnownValue2=u.GetY();break;
case 9:u.SetZElevation(this._initialValue+this.WaveFunc(this._i)*this._mag)}u.SetBboxChanged()}_OnSpriteFrameChanged(u,w){}_SetPeriod(u){this._period=u}_GetPeriod(){return this._period}_SetMagnitude(u){this._mag=u}_SetMagnitude_ConvertAngle(u){5===this._movement&&(u=e.toRadians(u));this._SetMagnitude(u)}_GetMagnitude(){return this._mag}_GetMagnitude_ConvertAngle(){let u=this._GetMagnitude();5===this._movement&&(u=e.toDegrees(u));return u}_SetMovement(u){5===this._movement&&5!==u&&(this._mag=e.toDegrees(this._mag));
this._movement=u;this.Init()}_GetMovement(){return this._movement}_SetWave(u){this._wave=u}_GetWave(){return this._wave}_SetPhase(u){this._i=e.clamp(u,0,2*Math.PI);this._UpdateFromPhase()}_GetPhase(){return this._i}_SetEnabled(u){(this._isEnabled=!!u)?this._StartTicking():this._StopTicking()}_IsEnabled(){return this._isEnabled}GetPropertyValueByIndex(u){switch(u){case 0:return this._movement;case 1:return this._wave;case 2:return this._basePeriod;case 6:return this._baseMag;case 8:return this._isEnabled}}SetPropertyValueByIndex(u,
w){switch(u){case 0:this._movement=h[w];this.Init();break;case 1:this._wave=w;break;case 2:this._basePeriod=w;this._period=this._basePeriod+this._periodRandom;this._isEnabled||(0!==this._period?(this._i=this._basePeriodOffset/this._period*d,this._i+=this._periodOffsetRandom/this._period*d):this._i=0);break;case 6:this._baseMag=w;this._mag=this._baseMag+this._magnitudeRandom;5===this._movement&&(this._mag=e.toRadians(this._mag));break;case 8:this._isEnabled=!!w}}GetDebuggerProperties(){return[{title:"$"+
this.GetBehaviorType().GetName(),properties:[{name:"behaviors.sin.properties.enabled.name",value:this._IsEnabled(),onedit:u=>this._SetEnabled(u)},{name:"behaviors.sin.properties.period.name",value:this._GetPeriod(),onedit:u=>this._SetPeriod(u)},{name:"behaviors.sin.properties.magnitude.name",value:this._GetMagnitude_ConvertAngle(),onedit:u=>this._SetMagnitude_ConvertAngle(u)},{name:"behaviors.sin.debugger.value",value:this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}]}]}GetScriptInterfaceClass(){return self.ISineBehaviorInstance}};
const g=new WeakMap,l="horizontal vertical size width height angle opacity value-only forwards-backwards z-elevation".split(" "),m=["sine","triangle","sawtooth","reverse-sawtooth","square"];self.ISineBehaviorInstance=class extends a{constructor(){super();g.set(this,a._GetInitInst().GetSdkInstance())}set period(u){b.RequireFiniteNumber(u);g.get(this)._SetPeriod(u)}get period(){return g.get(this)._GetPeriod()}set magnitude(u){b.RequireFiniteNumber(u);g.get(this)._SetMagnitude(u)}get magnitude(){return g.get(this)._GetMagnitude()}set phase(u){g.get(this)._SetPhase(u)}get phase(){return g.get(this)._GetPhase()}set movement(u){b.RequireString(u);
u=l.indexOf(u);if(-1===u)throw Error("invalid movement");g.get(this)._SetMovement(u)}get movement(){return l[g.get(this)._GetMovement()]}set wave(u){b.RequireString(u);u=m.indexOf(u);if(-1===u)throw Error("invalid wave");g.get(this)._SetWave(u)}get wave(){return m[g.get(this)._GetWave()]}get value(){const u=g.get(this);return u.WaveFunc(u._GetPhase())*u._GetMagnitude()}updateInitialState(){g.get(this).Init()}set isEnabled(u){g.get(this)._SetEnabled(!!u)}get isEnabled(){return g.get(this)._IsEnabled()}}}
{"use strict";const e=self.C3;e.Behaviors.Sin.Cnds={IsEnabled(){return this._IsEnabled()},CompareMovement(b){return this._GetMovement()===b},ComparePeriod(b,a){return e.compare(this._GetPeriod(),b,a)},CompareMagnitude(b,a){return e.compare(this._GetMagnitude_ConvertAngle(),b,a)},CompareWave(b){return this._GetWave()===b}}}"use strict";
self.C3.Behaviors.Sin.Acts={SetEnabled(e){this._SetEnabled(0!==e)},SetPeriod(e){this._SetPeriod(e)},SetMagnitude(e){this._SetMagnitude_ConvertAngle(e)},SetMovement(e){this._SetMovement(e)},SetWave(e){this._wave=e},SetPhase(e){const b=2*Math.PI;this._SetPhase(e*b%b)},UpdateInitialState(){this.Init()}};"use strict";
self.C3.Behaviors.Sin.Exps={CyclePosition(){return this._GetPhase()/(2*Math.PI)},Period(){return this._GetPeriod()},Magnitude(){return this._GetMagnitude_ConvertAngle()},Value(){return this.WaveFunc(this._GetPhase())*this._GetMagnitude_ConvertAngle()}};{"use strict";const e=self.C3;e.Behaviors.Anchor=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Anchor.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Behaviors.Anchor.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._anchorTop=this._anchorLeft=2;this._anchorBottom=this._anchorRight=0;this._isEnabled=!0;b=this._inst.GetWorldInfo().GetBoundingBox();this._xLeft=b.getLeft();this._yTop=b.getTop();this._xRight=this._runtime.GetOriginalViewportWidth()-b.getLeft();this._yBottom=this._runtime.GetOriginalViewportHeight()-b.getTop();this._rDiff=this._runtime.GetOriginalViewportWidth()-b.getRight();
this._bDiff=this._runtime.GetOriginalViewportHeight()-b.getBottom();a&&(this._anchorLeft=a[0],this._anchorTop=a[1],this._anchorRight=a[2],this._anchorBottom=a[3],this._isEnabled=!!a[4]);a=this._runtime.Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(a,"layoutchange",()=>this._OnLayoutChange()));this._isEnabled&&this._StartTicking()}Release(){super.Release()}SaveToJson(){return{xl:this._xLeft,yt:this._yTop,xr:this._xRight,yb:this._yBottom,rd:this._rDiff,bd:this._bDiff,al:this._anchorLeft,
at:this._anchorTop,ar:this._anchorRight,ab:this._anchorBottom,e:this._isEnabled}}LoadFromJson(b){this._xLeft=b.xl;this._yTop=b.yt;this._xRight=b.xr;this._yBottom=b.yb;this._rDiff=b.rd;this._bDiff=b.bd;this._anchorLeft=b.al;this._anchorTop=b.at;this._anchorRight=b.ar;this._anchorBottom=b.ab;(this._isEnabled=b.e)?this._StartTicking():this._StopTicking()}_UpdatePosition(){if(this._isEnabled){var b=this._inst.GetWorldInfo(),a=b.GetLayer().GetViewport();if(0===this._anchorLeft){var d=a.getLeft()+this._xLeft-
b.GetBoundingBox().getLeft();0!==d&&(b.OffsetX(d),b.SetBboxChanged())}else 1===this._anchorLeft&&(d=a.getRight()-this._xRight-b.GetBoundingBox().getLeft(),0!==d&&(b.OffsetX(d),b.SetBboxChanged()));0===this._anchorTop?(d=a.getTop()+this._yTop-b.GetBoundingBox().getTop(),0!==d&&(b.OffsetY(d),b.SetBboxChanged())):1===this._anchorTop&&(d=a.getBottom()-this._yBottom-b.GetBoundingBox().getTop(),0!==d&&(b.OffsetY(d),b.SetBboxChanged()));1===this._anchorRight&&(d=a.getRight()-this._rDiff-b.GetBoundingBox().getRight(),
0!==d&&(b.OffsetX(b.GetOriginX()*d),b.SetWidth(Math.max(b.GetWidth()+d),0),b.SetBboxChanged(),this._rDiff=a.getRight()-b.GetBoundingBox().getRight()));1===this._anchorBottom&&(d=a.getBottom()-this._bDiff-b.GetBoundingBox().getBottom(),0!==d&&(b.OffsetY(b.GetOriginY()*d),b.SetHeight(Math.max(b.GetHeight()+d,0)),b.SetBboxChanged(),this._bDiff=a.getBottom()-b.GetBoundingBox().getBottom()))}}Tick(){this._UpdatePosition()}_OnLayoutChange(){this._UpdatePosition()}GetPropertyValueByIndex(b){switch(b){case 0:return this._anchorLeft;
case 1:return this._anchorTop;case 2:return this._anchorRight;case 3:return this._anchorBottom;case 4:return this._isEnabled}}SetPropertyValueByIndex(b,a){switch(b){case 0:this._anchorLeft=a;break;case 1:this._anchorTop=a;break;case 2:this._anchorRight=a;break;case 3:this._anchorBottom=a;break;case 4:(this._isEnabled=!!a)?this._StartTicking():this._StopTicking()}}}}"use strict";self.C3.Behaviors.Anchor.Cnds={IsEnabled(){return this._isEnabled}};"use strict";
self.C3.Behaviors.Anchor.Acts={SetEnabled(e){this._isEnabled&&0===e?(this._isEnabled=!1,this._StopTicking()):this._isEnabled||0===e||(e=this._inst.GetWorldInfo().GetBoundingBox(),this._xLeft=e.getLeft(),this._yTop=e.getTop(),this._xRight=this._runtime.GetOriginalViewportWidth()-e.getLeft(),this._yBottom=this._runtime.GetOriginalViewportHeight()-e.getTop(),this._rDiff=this._runtime.GetOriginalViewportWidth()-e.getRight(),this._bDiff=this._runtime.GetOriginalViewportHeight()-e.getBottom(),this._isEnabled=
!0,this._StartTicking())}};"use strict";self.C3.Behaviors.Anchor.Exps={};{"use strict";const e=self.C3;e.Behaviors.solid=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.solid.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3,b=new Set;e.Behaviors.solid.Instance=class extends e.SDKBehaviorInstanceBase{constructor(a,d){super(a);this.SetEnabled(!0);d&&(this.SetEnabled(d[0]),this.SetTags(d[1]))}Release(){super.Release()}SetEnabled(a){this._inst._SetSolidEnabled(!!a)}IsEnabled(){return this._inst._IsSolidEnabled()}SetTags(a){const d=this._inst.GetSavedDataMap();if(a.trim()){var c=d.get("solidTags");c||(c=new Set,d.set("solidTags",c));c.clear();for(const f of a.split(" "))f&&c.add(f.toLowerCase())}else d.delete("solidTags")}GetTags(){return this._inst.GetSavedDataMap().get("solidTags")||
b}SaveToJson(){return{e:this.IsEnabled()}}LoadFromJson(a){this.SetEnabled(a.e)}GetPropertyValueByIndex(a){switch(a){case 0:return this.IsEnabled()}}SetPropertyValueByIndex(a,d){switch(a){case 0:this.SetEnabled(d)}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.solid.properties.enabled.name",value:this.IsEnabled(),onedit:a=>this.SetEnabled(a)}]}]}}}"use strict";self.C3.Behaviors.solid.Cnds={IsEnabled(){return this.IsEnabled()}};"use strict";
self.C3.Behaviors.solid.Acts={SetEnabled(e){this.SetEnabled(e)},SetTags(e){this.SetTags(e)}};"use strict";self.C3.Behaviors.solid.Exps={};{"use strict";const e=self.C3;e.Behaviors.Tween=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Tween.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3,b=e.Behaviors.Tween;b.Instance=class extends e.SDKBehaviorInstanceBase{constructor(a,d){super(a);this._allowMultiple=!1;this._enabled=!0;d&&(this._allowMultiple=!1,this._enabled=!!d[0]);this._activeTweens=new Map;this._disabledTweens=[];this._waitingForReleaseTweens=new Map;this._waitingForReleaseTweensJson=this._disabledTweensJson=this._activeTweensJson=this._finishingTween=null;this._finishingTweenName="";this._enabled&&this._StartTicking2();this._afterLoad=c=>this._OnAfterLoad(c);
this.GetRuntime().Dispatcher().addEventListener("afterload",this._afterLoad)}Release(){this.GetRuntime().Dispatcher().removeEventListener("afterload",this._afterLoad);this._afterLoad=null;this._finishingTween&&(this.ReleaseAndCompleteTween(this._finishingTween),this._finishingTween=null);this.ReleaseAndCompleteTweens();this._tweens=null;this.ClearDisabledList();this._disabledTweens=null;this._ReleaseWaitingTweens();this._waitingForReleaseTweens=null;super.Release()}SetEnabled(a){(this._enabled=a)?
this._StartTicking2():this._StopTicking2()}GetEnabled(){return this._enabled}AddToDisabledList(a){this._disabledTweens.push(a)}IsInDisabledList(a){return this._disabledTweens.includes(a)}ClearDisabledList(){e.clearArray(this._disabledTweens)}GetFinishingTween(){return this._finishingTween}IsInstanceValid(){const a=this.GetObjectInstance();return a?!a.IsDestroyed():!1}GetTween(a,d,c=!1){if((d=d?this.PropertyTweens(d,c):this.AllTweens(c))&&d.length)for(const f of d)if(f.HasTags(a))return f}GetTweenIncludingWaitingForRelease(a,
d){return this.GetTween(a,d,!0)}*GetTweens(a,d,c=!1){if((d=d?this.PropertyTweens(d,c):this.AllTweens(c))&&d.length)for(const f of d)f.HasTags(a)&&(yield f)}*GetTweensIncludingWaitingForRelease(a,d){yield*this.GetTweens(a,d,!0)}PropertyTweens(a,d){if(d)return d=this._activeTweens.get(a),a=this._waitingForReleaseTweens.get(a),d||(d=[]),a||(a=[]),d.concat(a).filter(c=>c);(a=this._activeTweens.get(a))||(a=[]);return a.filter(c=>c)}AllTweens(a){if(a){a=[...this._activeTweens.values()].flat();const d=[...this._waitingForReleaseTweens.values()].flat();
return a.concat(d).filter(c=>c)}return[...this._activeTweens.values()].flat().filter(d=>d)}AllTweensIncludingWaitingForRelease(){return this.AllTweens(!0)}SaveToJson(){return{s:!1,e:!!this._enabled,at:this._SaveActiveTweensToJson(),dt:this._SaveDisabledTweensToJson(),wt:this._SaveWaitingForReleaseTweensToJson(),ft:this._SaveFinishingTweenToJson()}}LoadFromJson(a){a&&(this._activeTweensJson=a.at,this._disabledTweensJson=a.dt,this._waitingForReleaseTweensJson=a.wt,this._finishingTweenName=a.ft,this._allowMultiple=
!1,this._enabled=!!a.e)}_OnAfterLoad(a){a=this.GetRuntime().GetTimelineManager();this._PopulateTweenMap(this._activeTweensJson,this._activeTweens,a);if(this._disabledTweensJson){e.clearArray(this._disabledTweens);for(const d of this._disabledTweensJson)this._PopulateTweenArray(this._disabledTweens,d,a)}this._PopulateTweenMap(this._waitingForReleaseTweensJson,this._waitingForReleaseTweens,a);this._finishingTween=this._GetTween(this._finishingTweenName,a);this._enabled?this._StartTicking2():this._StopTicking2()}_PopulateTweenMap(a,
d,c){if(a)for(const h in a){let g=d.get(h);g?e.clearArray(g):g=[];var f=a[h];for(const l of f)this._PopulateTweenArray(g,l.name,c)?this._LoadTweenFromJson(l.name,l,c):(f=e.TweenState.Build({runtime:this.GetRuntime(),json:l}),f.AddCompletedCallback(m=>this._FinishTriggers(m)),c.AddScheduledTimeline(f),this._PopulateTweenArray(g,f,c));d.set(h,g)}}_GetTween(a,d){return d.GetScheduledOrPlayingTimelineByName(a)}_PopulateTweenArray(a,d,c){if("string"===typeof d){if(d=this._GetTween(d,c))return!!a.push(d)}else return!!a.push(d);
return!1}_LoadTweenFromJson(a,d,c){"string"===typeof a?(a=this._GetTween(a,c))&&a._LoadFromJson(d):a._LoadFromJson(d)}_SaveActiveTweensToJson(){const a={};for(const [d,c]of this._activeTweens)a[d]=c.map(f=>f._SaveToJson());return a}_SaveDisabledTweensToJson(){return this._disabledTweens.map(a=>a.GetName())}_SaveWaitingForReleaseTweensToJson(){const a={};for(const [d,c]of this._waitingForReleaseTweens)a[d]=c.map(f=>f._SaveToJson());return a}_SaveFinishingTweenToJson(){return this._finishingTween?this._finishingTween.GetName():
""}Tick2(){this._ReleaseWaitingTweens()}CreateTween(a){var d=b.Config.GetPropertyTracksConfig(a.property,a.startValue,a.endValue,a.ease,a.resultMode,this.GetObjectInstance());const c=b.Maps.GetPropertyFromIndex(a.property);b.Maps.IsValueId(c)||this.ReleaseTweens(a.property);d=e.TweenState.Build({runtime:this.GetRuntime(),id:c,tags:a.tags,time:a.time,instance:this.GetObjectInstance(),releaseOnComplete:!!a.releaseOnComplete,loop:!!a.loop,pingPong:!!a.pingPong,initialValueMode:a.initialValueMode,propertyTracksConfig:d});
d.AddCompletedCallback(f=>this._FinishTriggers(f));this._AddTween(d,a.property);return d}ReleaseTween(a,d=!1){var c=a.GetId();if(this._activeTweens.has(c)&&(c=this._activeTweens.get(c))){const f=c.indexOf(a);-1!==f&&c.splice(f,1)}a.IsReleased()||this._IsInWaitingList(a)||(a.Stop(d),this._AddToWaitingList(a))}ReleaseTweens(a,d=!1){if(e.IsFiniteNumber(a)){var c=b.Maps.GetPropertyFromIndex(a);if(this._activeTweens.has(c)){c=this._activeTweens.get(c);var f=this.GetFinishingTween();for(var h of c)h===
f||h.IsReleased()||this._IsInWaitingList(h)||(h.Stop(d),h.Release());e.clearArray(c)}}else{h=this.GetFinishingTween();for(c of this.AllTweens())c===h||c.IsReleased()||this._IsInWaitingList(c)||(c.Stop(d),c.Release());for(f of this._activeTweens.keys())e.clearArray(this._activeTweens.get(f)),this._activeTweens.delete(f);this._activeTweens.clear()}}ReleaseAndCompleteTween(a){this.ReleaseTween(a,!0)}ReleaseAndCompleteTweens(){this.ReleaseTweens(NaN,!0)}GetPropertyValueByIndex(a){switch(a){case 0:return this._enabled}}SetPropertyValueByIndex(a,
d){switch(a){case 0:this._enabled=!!d}}_GetBehaviorType(a){a=a.GetInstance().GetBehaviorInstances();for(const d of a)if(a=d.GetBehaviorType(),a.GetInstanceSdkCtor()===this.constructor)return a}Trigger(a,d,c,f){return this._runtime?super.Trigger(a):d.Trigger(a,c,f)}_FinishTriggers(a){this._finishingTween=a;b.Cnds.SetFinishingTween(a);let d,c;if(this.GetRuntime())d=this._inst,c=this._runtime,this.Trigger(b.Cnds.OnTweensFinished),this.Trigger(b.Cnds.OnAnyTweensFinished),this.ReleaseTween(a);else{d=a.GetInstance();
if(!d||d&&d.IsDestroyed())return;c=d.GetRuntime();const f=this._GetBehaviorType(a);this.Trigger(b.Cnds.OnTweensFinished,c,d,f);this.Trigger(b.Cnds.OnAnyTweensFinished,c,d,f);a.Stop()}this._finishingTween=null;b.Cnds.SetFinishingTween(null);a.GetDestroyInstanceOnComplete()&&c.DestroyInstance(d)}_AddTween(a,d){d=b.Maps.GetPropertyFromIndex(d);this._activeTweens.has(d)||this._activeTweens.set(d,[]);this._activeTweens.get(d).push(a)}_AddToWaitingList(a){const d=a.GetId();this._waitingForReleaseTweens.has(d)||
this._waitingForReleaseTweens.set(d,[]);this._waitingForReleaseTweens.get(d).push(a)}_IsInWaitingList(a){const d=a.GetId();return this._waitingForReleaseTweens.has(d)?this._waitingForReleaseTweens.get(d).includes(a):!1}_ReleaseWaitingTweens(){if(this._waitingForReleaseTweens.size){for(const a of this._waitingForReleaseTweens.values()){for(const d of a)d.IsReleased()||d.Release();e.clearArray(a)}this._waitingForReleaseTweens.clear()}}}}
{"use strict";const e=self.C3;let b=null;e.Behaviors.Tween.Cnds={SetFinishingTween(a){b=a},OnTweensFinished(a){return b.HasTags(a)},OnAnyTweensFinished(){return!0},IsPlaying(a){return(a=[...this.GetTweensIncludingWaitingForRelease(a)],a.length)?a.some(e.TweenState.IsPlaying):!1},IsAnyPlaying(){const a=[...this.AllTweensIncludingWaitingForRelease()];return a&&a.length?a.some(e.TweenState.IsPlaying):!1},IsPaused(a){return(a=[...this.GetTweensIncludingWaitingForRelease(a)],a.length)?a.some(e.TweenState.IsPaused):
!1},IsAnyPaused(){const a=[...this.AllTweensIncludingWaitingForRelease()];return a&&a.length?a.some(e.TweenState.IsPaused):!1}}}
{"use strict";const e=self.C3,b=self.Ease,a=e.Behaviors.Tween;a.Acts={SetEnabled(d){this.SetEnabled(!!d);for(const c of this.AllTweens())d?this.IsInDisabledList(c)&&c.Resume():((c.IsPlaying()||c.IsScheduled())&&this.AddToDisabledList(c),c.Stop());d&&this.ClearDisabledList()},async TweenOneProperty(...d){this.GetEnabled()&&this.IsInstanceValid()&&(d=this.CreateTween(a.TweenArguments.OneProperty(this,...d)),d.Play()&&await d.GetPlayPromise())},async TweenTwoProperties(...d){this.GetEnabled()&&this.IsInstanceValid()&&
(d=this.CreateTween(a.TweenArguments.TwoProperties(this,...d)),d.Play()&&await d.GetPlayPromise())},async TweenValue(...d){this.GetEnabled()&&this.IsInstanceValid()&&(d=this.CreateTween(a.TweenArguments.ValueProperty(this,...d)),d.Play()&&await d.GetPlayPromise())},PauseTweens(d){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(d))c.Stop()},PauseAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())d.Stop()},ResumeTweens(d){if(this.GetEnabled()&&
this.IsInstanceValid())for(const c of this.GetTweens(d))c.Resume()},ResumeAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())d.Resume()},StopTweens(d){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.GetTweens(d))this.ReleaseTween(c)},StopAllTweens(){if(this.GetEnabled()&&this.IsInstanceValid())for(const d of this.AllTweens())this.ReleaseTween(d)},SetOnePropertyTweensEndValue(d,c,f){if(this.GetEnabled()&&this.IsInstanceValid()){c=e.Behaviors.Tween.Maps.GetSinglePropertyFromIndex(c);
for(const h of this.GetTweens(d))h.BeforeSetEndValues([c]),h.SetEndValue(f,c)}},SetTwoPropertiesTweensEndValue(d,c,f,h){if(this.GetEnabled()&&this.IsInstanceValid()){c=e.Behaviors.Tween.Maps.GetRealProperties(c);for(const g of this.GetTweens(d))g.BeforeSetEndValues(c),g.SetEndValue(f,c[0]),g.SetEndValue(h,c[1])}},SetValuePropertyTweensStartValue(d,c){if(this.GetEnabled()&&this.IsInstanceValid())for(const f of this.GetTweens(d,"value"))f.SetStartValue(c,"value")},SetValuePropertyTweensEndValue(d,c){if(this.GetEnabled()&&
this.IsInstanceValid())for(const f of this.GetTweens(d,"value"))f.BeforeSetEndValues(["value"]),f.SetEndValue(c,"value")},SetTweensEase(d,c){if(this.GetEnabled()&&this.IsInstanceValid()){c=b.GetEaseFromIndex(c);for(const f of this.GetTweens(d))f.SetEase(c)}},SetAllTweensEase(d){if(this.GetEnabled()&&this.IsInstanceValid()){d=b.GetEaseFromIndex(d);for(const c of this.AllTweens())c.SetEase(d)}},SetTweensTime(d,c){if(this.GetEnabled()&&this.IsInstanceValid())for(const f of this.GetTweens(d))f.SetTime(c)},
SetAllTweensTime(d){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())c.SetTime(d)},SetTweensPlaybackRate(d,c){if(this.GetEnabled()&&this.IsInstanceValid())for(const f of this.GetTweens(d))f.SetPlaybackRate(c)},SetAllTweensPlaybackRate(d){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())c.SetPlaybackRate(d)},SetTweensDestroyOnComplete(d,c){if(this.GetEnabled()&&this.IsInstanceValid())for(const f of this.GetTweens(d))f.SetDestroyInstanceOnComplete(!!c)},
SetAllTweensDestroyOnComplete(d){if(this.GetEnabled()&&this.IsInstanceValid())for(const c of this.AllTweens())c.SetDestroyInstanceOnComplete(!!d)}}}"use strict";
self.C3.Behaviors.Tween.Exps={Time(e){return(e=this.GetTweenIncludingWaitingForRelease(e))?e.GetTime():0},Progress(e){return(e=this.GetTweenIncludingWaitingForRelease(e))?e.GetTime()/e.GetTotalTime():0},Value(e){return(e=this.GetTweenIncludingWaitingForRelease(e,"value"))?e.GetPropertyTrack("value").GetSourceAdapterValue():0},Tags(){return this.GetFinishingTween()?this.GetFinishingTween().GetStringTags():""}};
{"use strict";const e=self.C3,b=self.Ease,a=["position","size","scale"],d="offsetX offsetY offsetWidth offsetHeight offsetAngle offsetOpacity offsetColor offsetZElevation offsetScaleX offsetScaleY".split(" "),c=["value"],f=[].concat(a).concat(d).concat(c),h={position:["offsetX","offsetY"],size:["offsetWidth","offsetHeight"],scale:["offsetScaleX","offsetScaleY"]},g=Object.assign({},f.reduce((l,m)=>Object.assign({},l,{[m]:[m]}),{}),h);e.Behaviors.Tween.Maps=class{constructor(){}static GetEases(){return[...b.GetRuntimeEaseNames()]}static GetEaseFromIndex(l){return[...b.GetRuntimeEaseNames()][l]}static GetPropertyFromIndex(l){return f[l]}static GetPropertyIndexFromName(l){return f.indexOf(l)}static GetPairPropertyFromIndex(l){return a[l]}static GetSinglePropertyFromIndex(l){return d[l]}static GetValuePropertyFromIndex(l){return c[l]}static GetPairProperties(l){return h[l]}static GetRealProperties(l){return e.IsString(l)?
g[l]:g[f[l]]}static IsPairId(l){return!!h[l]}static IsColorId(l){return"offsetColor"===l}static IsAngleId(l){return"offsetAngle"===l}static IsOpacityId(l){return"offsetOpacity"===l}static IsValueId(l){return"value"===l}}}
{"use strict";const e=self.C3,b=e.Behaviors.Tween,a=new Map;b.Config=class{constructor(){}static GetPropertyTracksConfig(d,c,f,h,g,l){0===a.size&&this._CreateConfigObjects();var m=b.PropertyTypes.Pick(d);m=a.get(m);e.IsFiniteNumber(d)&&(d=b.Maps.GetPropertyFromIndex(d));return this._GetConfig(m,d,c,f,h,g,l)}static TransformValue(d,c){return e.Behaviors.Tween.GetPropertyTracksConfig(d).valueGetter(c)}static _CreateConfigObjects(){const d=b.PropertyTypes,c=b.ValueGetters;this._AddConfigObject(d.PAIR,
this._GetPairConfig,c._GetPropertyValue);this._AddConfigObject(d.COLOR,this._GetColorConfig,c._GetColorPropertyValue);this._AddConfigObject(d.ANGLE,this._GetAngleConfig,c._GetPropertyAngleValue);this._AddConfigObject(d.VALUE,this._GetValueConfig,c._GetPropertyValue);this._AddConfigObject(d.OTHER,this._GetCommonConfig,c._GetPropertyValue)}static _AddConfigObject(d,c,f){a.set(d,this._CreateConfigObject(d,c,f))}static _CreateConfigObject(d,c,f){return{name:d,configFunc:c,valueGetter:f}}static _GetConfig(d,
c,f,h,g,l,m){return d.configFunc(c,d.valueGetter(f),d.valueGetter(h),g,l,m)}static _GetPairConfig(d,c,f,h,g,l){return b.Maps.GetPairProperties(d).map((m,u)=>({sourceId:"world-instance",property:m,type:"float",valueType:"numeric",startValue:c[u],endValue:f[u],ease:b.Maps.GetEaseFromIndex(h),resultMode:g}))}static _GetColorConfig(d,c,f,h,g,l){return e.Plugins.Text&&l.GetPlugin()instanceof e.Plugins.Text?{sourceId:"plugin",sourceArgs:[7],property:"color",type:"color",valueType:"color",startValue:c,endValue:f,
ease:b.Maps.GetEaseFromIndex(h),resultMode:g}:{sourceId:"world-instance",property:d,type:"color",valueType:"color",startValue:c,endValue:f,ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetAngleConfig(d,c,f,h,g,l){return{sourceId:"world-instance",property:d,type:"angle",valueType:"angle",startValue:c,endValue:f,ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetCommonConfig(d,c,f,h,g,l){return{sourceId:"world-instance",property:d,type:"float",valueType:"numeric",startValue:c,endValue:f,
ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}static _GetValueConfig(d,c,f,h,g,l){return{sourceId:"value",property:d,type:"float",valueType:"numeric",startValue:c,endValue:f,ease:b.Maps.GetEaseFromIndex(h),resultMode:g}}}}
{"use strict";const e=self.C3,b=e.Behaviors.Tween,a=Object.assign({},{resultMode:"absolute"},{tags:"",property:"",time:0,ease:0,releaseOnComplete:0,loop:!1,pingPong:!1}),d=Object.assign({},a,{initialValueMode:"current-state",startValue:0,endValue:0}),c=Object.assign({},a,{initialValueMode:"current-state",startValue:[0,0],endValue:[0,0]}),f=Object.assign({},a,{initialValueMode:"current-state",startValue:[0,0,0],endValue:[0,0,0]}),h=Object.assign({},d,{initialValueMode:"start-value"});b.TweenArguments=
class{constructor(){}static _SetCommonProperties(g,l,m,u,w,q,t){g.tags=l;g.time=m;g.ease=u;g.releaseOnComplete=w;g.loop=q;g.pingPong=t}static OneProperty(g,l,m,u,w,q,t,p,r){g=b.Maps.GetSinglePropertyFromIndex(m);m=b.Maps.IsColorId(g)?f:d;this._SetCommonProperties(m,l,w,q,t,p,r);b.Maps.IsColorId(g)?(f.endValue[0]=e.GetRValue(u),f.endValue[1]=e.GetGValue(u),f.endValue[2]=e.GetBValue(u),f.property=b.Maps.GetPropertyIndexFromName(g)):b.Maps.IsOpacityId(g)?d.endValue=u/100:d.endValue=u;m.property=b.Maps.GetPropertyIndexFromName(g);
return m}static TwoProperties(g,l,m,u,w,q,t,p,r,x){this._SetCommonProperties(c,l,q,t,p,r,x);g=b.Maps.GetPairPropertyFromIndex(m);c.endValue[0]=u;c.endValue[1]=w;c.property=b.Maps.GetPropertyIndexFromName(g);return c}static ValueProperty(g,l,m,u,w,q,t,p,r){this._SetCommonProperties(h,l,w,q,t,p,r);h.startValue=m;h.endValue=u;h.property=b.Maps.GetPropertyIndexFromName("value");return h}}}
{"use strict";const e=self.C3,b=e.Behaviors.Tween,a=[];b.PropertyTypes=class{constructor(){}static Pick(d){0===a.length&&(a.push({checkFunc:b.Maps.IsPairId,result:this.PAIR}),a.push({checkFunc:b.Maps.IsColorId,result:this.COLOR}),a.push({checkFunc:b.Maps.IsAngleId,result:this.ANGLE}),a.push({checkFunc:b.Maps.IsValueId,result:this.VALUE}),a.push({checkFunc:()=>!0,result:this.OTHER}));e.IsFiniteNumber(d)&&(d=e.Behaviors.Tween.Maps.GetPropertyFromIndex(d));for(const c of a)if(c.checkFunc(d))return c.result}static get PAIR(){return"pair"}static get COLOR(){return"color"}static get ANGLE(){return"angle"}static get VALUE(){return"value"}static get OTHER(){return"other"}}}
{"use strict";const e=self.C3;e.Behaviors.Tween.ValueGetters=class{constructor(){}static _GetPropertyAngleValue(b){b=e.toRadians(parseFloat(b));return e.clampAngle(b)}static _GetColorPropertyValue(b){return b.slice(0)}static _GetPropertyValue(b){return b}}}{"use strict";const e=self.C3;e.Behaviors.Platform=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Platform.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3,b=self.C3X,a=self.IBehaviorInstance;function d(h,g,l,m,u){return e.clamp(h*u+.5*m*u*u,g*u,l*u)}e.Behaviors.Platform.Instance=class extends e.SDKBehaviorInstanceBase{constructor(h,g){super(h);this._keyboardDisposables=null;this._simJump=this._simRight=this._simLeft=this._ignoreInput=this._canDoubleJump=this._doubleJumped=this._jumped=this._jumpKey=this._rightKey=this._leftKey=!1;this._lastFloorObject=null;this._loadFloorUid=-1;this._lastFloorY=this._lastFloorX=0;this._wasOnFloor=
this._floorIsJumpthru=!1;this._wasOverJumpthru=!!this._runtime.GetCollisionEngine().TestOverlapJumpthru(this._inst);this._loadJumpthruUid=-1;this._animMode="stopped";this._fallThrough=0;this._isFirstTick=!0;this._rightY=this._rightX=this._downY=this._downX=this._dy=this._dx=0;this._g1=this._g=1500;this._ga=e.toRadians(90);this._maxSpeed=330;this._dec=this._acc=1500;this._jumpStrength=650;this._maxFall=1E3;this._enableDoubleJump=!1;this._sustainTime=this._jumpSustain=0;this._defaultControls=!0;this._ceilingCollisionMode=
0;this._isEnabled=!0;g&&(this._maxSpeed=g[0],this._acc=g[1],this._dec=g[2],this._jumpStrength=g[3],this._g=g[4],this._maxFall=g[5],this._enableDoubleJump=!!g[6],this._jumpSustain=g[7]/1E3,this._defaultControls=!!g[8],this._isEnabled=!!g[9]);h=this._runtime.Dispatcher();this._disposables=new e.CompositeDisposable(e.Disposable.From(h,"instancedestroy",l=>this._OnInstanceDestroyed(l.instance)),e.Disposable.From(h,"afterload",l=>this._OnAfterLoad()));this._defaultControls&&this._BindEvents();this._isEnabled&&
this._StartPostTicking();this._UpdateGravity();this._inst.GetUnsavedDataMap().set("isPlatformBehavior",!0)}Release(){this._keyboardDisposables&&(this._keyboardDisposables.Release(),this._keyboardDisposables=null);this._wasOverJumpthru=this._lastFloorObject=null;super.Release()}_BindEvents(){if(!this._keyboardDisposables){var h=this._runtime.Dispatcher();this._keyboardDisposables=new e.CompositeDisposable(e.Disposable.From(h,"keydown",g=>this._OnKeyDown(g.data)),e.Disposable.From(h,"keyup",g=>this._OnKeyUp(g.data)),
e.Disposable.From(h,"window-blur",()=>this._OnWindowOrKeyboardBlur()),e.Disposable.From(h,"keyboard-blur",()=>this._OnWindowOrKeyboardBlur()))}}_UnBindEvents(){this._keyboardDisposables&&(this._keyboardDisposables.Release(),this._keyboardDisposables=null)}_OnInstanceDestroyed(h){this._lastFloorObject===h&&(this._lastFloorObject=null);this._wasOverJumpthru===h&&(this._wasOverJumpthru=null)}_OnKeyDown(h){switch(h.key){case "ArrowLeft":this._leftKey=!0;break;case "ArrowRight":this._rightKey=!0;break;
case "ArrowUp":this._jumpKey=!0}}_OnKeyUp(h){switch(h.key){case "ArrowLeft":this._leftKey=!1;break;case "ArrowRight":this._rightKey=!1;break;case "ArrowUp":this._jumped=this._jumpKey=!1}}_OnWindowOrKeyboardBlur(){this._jumped=this._jumpKey=this._rightKey=this._leftKey=!1}SaveToJson(){return{ii:this._ignoreInput,lfx:this._lastFloorX,lfy:this._lastFloorY,lfo:this._lastFloorObject?this._lastFloorObject.GetUID():-1,am:this._animMode,en:this._isEnabled,fall:this._fallThrough,ft:this._isFirstTick,dx:this._dx,
dy:this._dy,ms:this._maxSpeed,acc:this._acc,dec:this._dec,js:this._jumpStrength,g:this._g,g1:this._g1,mf:this._maxFall,wof:this._wasOnFloor,woj:this._wasOverJumpthru?this._wasOverJumpthru.GetUID():-1,ga:this._ga,edj:this._enableDoubleJump,cdj:this._canDoubleJump,dj:this._doubleJumped,sus:this._jumpSustain,dc:this._defaultControls,cc:this._ceilingCollisionMode}}LoadFromJson(h){this._ignoreInput=h.ii;this._lastFloorX=h.lfx;this._lastFloorY=h.lfy;this._loadFloorUid=h.lfo;this._animMode=h.am;const g=
h.en;this._fallThrough=h.fall;this._isFirstTick=h.ft;this._dx=h.dx;this._dy=h.dy;this._maxSpeed=h.ms;this._acc=h.acc;this._dec=h.dec;this._jumpStrength=h.js;this._g=h.g;this._g1=h.g1;this._maxFall=h.mf;this._wasOnFloor=h.wof;this._loadJumpthruUid=h.woj;this._ga=h.ga;this._enableDoubleJump=h.edj;this._canDoubleJump=h.cdj;this._doubleJumped=h.dj;this._jumpSustain=h.sus;this._defaultControls=h.dc;this._ceilingCollisionMode=h.cc||0;this._simJump=this._simRight=this._simLeft=this._jumped=this._jumpKey=
this._rightKey=this._leftKey=!1;this._sustainTime=0;this._defaultControls?this._BindEvents():this._UnBindEvents();this._SetEnabled(g);this._UpdateGravity()}_OnAfterLoad(){this._lastFloorObject=-1===this._loadFloorUid?null:this._runtime.GetInstanceByUID(this._loadFloorUid);this._wasOverJumpthru=-1===this._loadJumpthruUid?null:this._runtime.GetInstanceByUID(this._loadJumpthruUid)}_UpdateGravity(){this._downX=Math.cos(this._ga);this._downY=Math.sin(this._ga);this._rightX=Math.cos(this._ga-Math.PI/2);
this._rightY=Math.sin(this._ga-Math.PI/2);this._downX=e.round6dp(this._downX);this._downY=e.round6dp(this._downY);this._rightX=e.round6dp(this._rightX);this._rightY=e.round6dp(this._rightY);this._g1=this._g;0>this._g&&(this._downX*=-1,this._downY*=-1,this._g=Math.abs(this._g))}_GetGDir(){return 0>this._g?-1:1}_IsOnFloor(){var h=this._inst.GetWorldInfo();const g=this._runtime.GetCollisionEngine(),l=this._inst;var m=this._lastFloorObject;const u=h.GetX(),w=h.GetY();h.OffsetXY(this._downX,this._downY);
h.SetBboxChanged();if(!m||!g.TestOverlap(l,m)||m.GetObjectClass().HasSolidBehavior()&&!g.IsSolidCollisionAllowed(m,l)||m.GetObjectClass().HasJumpthruBehavior()&&!m._IsJumpthruEnabled()){let q=g.TestOverlapSolid(l);m=null;q||0!==this._fallThrough||(m=g.TestOverlapJumpthru(l,!0));h.SetXY(u,w);h.SetBboxChanged();if(q){if(g.TestOverlap(l,q))return null;this._floorIsJumpthru=!1;return q}if(m&&m.length){h=0;for(let t=0,p=m.length;t<p;++t)m[h]=m[t],g.TestOverlap(l,m[t])||++h;if(1<=h)return this._floorIsJumpthru=
!0,m[0]}return null}h.SetXY(u,w);h.SetBboxChanged();return m}PostTick(){if(this._isEnabled){var h=this._runtime.GetDt(this._inst);this._jumpKey||this._simJump||(this._jumped=!1);var g=this._leftKey||this._simLeft,l=this._rightKey||this._simRight,m=this._jumpKey||this._simJump,u=m&&!this._jumped;this._simJump=this._simRight=this._simLeft=!1;this._ignoreInput&&(u=m=l=g=!1);m||(this._sustainTime=0);this._HandleFirstTick();var [w,,q]=this._TrackMovingPlatform(),t=this._IsOnFloor(),p=t&&!this._wasOnFloor,
r;[r,t]=this._MaybePushOutSolid(t);if(!r){this._TrackFloor(t,q,w,m);u=this._HandleJump(t,u,m);t||this._ApplyJumpGravity(u,m,h);this._wasOnFloor=!!t;g=this._ApplyHorizontalAcceleration(g,l,h);l=!1;m=0;0!==this._dx&&(l=this._HandleHorizontalMovement(h,g,t,u));if(0!==this._dy){const [x,y]=this._HandleVerticalMovement(h,t);l=l||x;m=y}!l&&p&&0>this._dy&&0<m&&(this._dy=0,l=!0);this._HandleAnimationTriggers(t,l,u);0<this._fallThrough&&this._fallThrough--;this._wasOverJumpthru=this._runtime.GetCollisionEngine().TestOverlapJumpthru(this._inst)}}}_HandleFirstTick(){if(this._isFirstTick){var h=
this._inst,g=this._runtime.GetCollisionEngine();(g.TestOverlapSolid(h)||g.TestOverlapJumpthru(h))&&g.PushOutSolid(h,-this._downX,-this._downY,4,!0);this._isFirstTick=!1}}_TrackMovingPlatform(){var h=this._lastFloorObject,g=h?h.GetWorldInfo():null;let l=0,m=0;var u=!1;if(h&&0===this._dy&&(g.GetY()!==this._lastFloorY||g.GetX()!==this._lastFloorX)){h=this._inst;u=h.GetWorldInfo();const w=this._runtime.GetCollisionEngine(),q=g.GetX();g=g.GetY();l=q-this._lastFloorX;m=g-this._lastFloorY;u.OffsetXY(l,m);
u.SetBboxChanged();this._lastFloorX=q;this._lastFloorY=g;u=!0;w.TestOverlapSolid(h)&&w.PushOutSolid(h,-l,-m,2.5*Math.hypot(l,m))}return[l,m,u]}_MaybePushOutSolid(h){let g=!1;var l=this._inst,m=l.GetWorldInfo();const u=this._runtime.GetCollisionEngine(),w=u.TestOverlapSolid(l);if(!w)return[!1,h];const q=Math.abs(m.GetWidth());m=Math.abs(m.GetHeight());l.GetSavedDataMap().get("inputPredicted")?u.PushOutSolid(l,-this._downX,-this._downY,10,!1):u.PushOutSolid(l,-this._downX,-this._downY,m/8)?(u.RegisterCollision(l,
w),this._lastFloorObject=h=w,l=w.GetWorldInfo(),this._lastFloorX=l.GetX(),this._lastFloorY=l.GetY(),this._floorIsJumpthru=!1):u.PushOutSolidAxis(l,this._rightX,this._rightY,q/2)||u.PushOutSolidAxis(l,this._downX,this._downY,m/2)||u.PushOutSolidNearest(l,Math.max(q,m)/2)?u.RegisterCollision(l,w):g=!0;return[g,h]}_TrackFloor(h,g,l,m){const u=this._inst,w=this._runtime.GetCollisionEngine();if(h){m=this._downX;const q=this._downY,t=this._rightX,p=this._rightY;this._canDoubleJump=this._doubleJumped=!1;
0<this._dy&&(this._wasOnFloor||(w.PushInFractional(u,-m,-q,h,16),this._wasOnFloor=!0),this._dy=0);this._lastFloorObject!==h?(this._lastFloorObject=h,l=h.GetWorldInfo(),this._lastFloorX=l.GetX(),this._lastFloorY=l.GetY(),w.RegisterCollision(u,h)):g&&(h=w.TestOverlapSolid(u))&&(w.RegisterCollision(u,h),0!==l&&(0<l?w.PushOutSolid(u,-t,-p):w.PushOutSolid(u,t,p)),w.PushOutSolid(u,-m,-q))}else m||(this._canDoubleJump=!0)}_HandleJump(h,g,l){if(h&&g||!h&&this._enableDoubleJump&&l&&this._canDoubleJump&&!this._doubleJumped){g=
this._inst;l=g.GetWorldInfo();const m=this._runtime.GetCollisionEngine(),u=l.GetX(),w=l.GetY();l.OffsetXY(-this._downX,-this._downY);l.SetBboxChanged();m.TestOverlapSolid(g)?g=!1:(this._sustainTime=this._jumpSustain,this.Trigger(e.Behaviors.Platform.Cnds.OnJump),this._animMode="jumping",this._dy=-this._jumpStrength,g=!0,h?this._jumped=!0:this._doubleJumped=!0);l.SetXY(u,w);l.SetBboxChanged()}return g}_ApplyJumpGravity(h,g,l){g&&0<this._sustainTime?(this._dy=-this._jumpStrength,this._sustainTime-=
l):(this._lastFloorObject=null,this._dy+=this._g*l,this._dy>this._maxFall&&(this._dy=this._maxFall));h&&(this._jumped=!0)}_ApplyHorizontalAcceleration(h,g,l){const m=this._acc,u=this._dec;h===g&&(0>this._dx?(this._dx+=u*l,0<this._dx&&(this._dx=0)):0<this._dx&&(this._dx-=u*l,0>this._dx&&(this._dx=0)));let w=0;h&&!g&&(w=0<this._dx?-(m+u):-m);g&&!h&&(w=0>this._dx?m+u:m);this._dx+=w*l;this._dx=e.clamp(this._dx,-this._maxSpeed,this._maxSpeed);return w}_HandleHorizontalMovement(h,g,l,m){const u=this._inst;
var w=u.GetWorldInfo();const q=this._runtime.GetCollisionEngine(),t=this._downX,p=this._downY,r=this._rightX,x=this._rightY;var y=this._maxSpeed;let D=!1;var G=w.GetX();let A=w.GetY();var F=d(this._dx,-y,y,g,h)*r;const J=d(this._dx,-y,y,g,h)*x;w.OffsetXY(r*(1<this._dx?1:-1)-t,x*(1<this._dx?1:-1)-p);w.SetBboxChanged();g=!1;y=q.TestOverlapSolid(u);w.SetXY(G+F,A+J);w.SetBboxChanged();let B=q.TestOverlapSolid(u);!B&&l&&(B=q.TestOverlapJumpthru(u))&&(w.SetXY(G,A),w.SetBboxChanged(),q.TestOverlap(u,B)?
(B=null,g=!1):g=!0,w.SetXY(G+F,A+J),w.SetBboxChanged());B?(F=Math.abs(this._dx*h)+2,y||!q.PushOutSolid(u,-t,-p,F,g,B))?(q.RegisterCollision(u,B),F=Math.max(Math.abs(this._dx*h*2.5),30),q.PushOutSolid(u,r*(0>this._dx?1:-1),x*(0>this._dx?1:-1),F,!1)?!l||g||this._floorIsJumpthru||(G=w.GetX(),A=w.GetY(),w.OffsetXY(t,p),q.TestOverlapSolid(u)?q.PushOutSolid(u,-t,-p,3,!1)||(w.SetXY(G,A),w.SetBboxChanged()):(w.SetXY(G,A),w.SetBboxChanged())):(w.SetXY(G,A),w.SetBboxChanged()),g||(this._dx=0)):!y&&!m&&Math.abs(this._dy)<
Math.abs(this._jumpStrength/4)&&(this._dy=0,l||(D=!0)):(G=this._IsOnFloor(),l&&!G?(h=Math.ceil(Math.abs(this._dx*h))+2,G=w.GetX(),A=w.GetY(),w.OffsetXY(t*h,p*h),w.SetBboxChanged(),q.TestOverlapSolid(u)||q.TestOverlapJumpthru(u)?q.PushOutSolid(u,-t,-p,h+2,!0):(w.SetXY(G,A),w.SetBboxChanged())):G&&(!l&&this._floorIsJumpthru&&(this._lastFloorObject=G,w=G.GetWorldInfo(),this._lastFloorX=w.GetX(),this._lastFloorY=w.GetY(),this._dy=0,D=!0),0===this._dy&&q.PushInFractional(u,-t,-p,G,16)));return D}_HandleVerticalMovement(h,
g){const l=this._inst,m=l.GetWorldInfo(),u=this._runtime.GetCollisionEngine(),w=this._downX,q=this._downY;let t=!1,p=m.GetX(),r=m.GetY();const x=d(this._dy,-Infinity,this._maxFall,this._g,h);m.OffsetXY(x*w,x*q);var y=m.GetX();const D=m.GetY();m.SetBboxChanged();let G=u.TestOverlapSolid(l);var A=!1;if(!G&&0<this._dy&&!g){if((A=0<this._fallThrough?null:u.TestOverlapJumpthru(l,!0))&&A.length){if(this._wasOverJumpthru){m.SetXY(p,r);m.SetBboxChanged();g=0;for(let F=0,J=A.length;F<J;++F)A[g]=A[F],u.TestOverlap(l,
A[F])||++g;e.truncateArray(A,g);m.SetXY(y,D);m.SetBboxChanged()}1<=A.length&&(G=A[0])}A=!!G}if(G)if(u.RegisterCollision(l,G),this._sustainTime=0,y=1.1,A&&!this._wasOverJumpthru&&(y=2),u.PushOutSolid(l,w*(0>this._dy?1:-1),q*(0>this._dy?1:-1),Math.max(Math.abs(this._dy*h*y),2),A,G)){this._lastFloorObject=G;h=G.GetWorldInfo();this._lastFloorX=h.GetX();this._lastFloorY=h.GetY();(this._floorIsJumpthru=A)&&(t=!0);if(0<this._dy||0===this._ceilingCollisionMode)this._dy=0;0>this._dy&&1===this._ceilingCollisionMode&&
u.PushInFractional(l,w,q,G,32)}else m.SetXY(p,r),m.SetBboxChanged(),this._wasOnFloor=!0,A||(this._dy=0);return[t,x]}_HandleAnimationTriggers(h,g,l){"falling"!==this._animMode&&0<this._dy&&!h&&(this.Trigger(e.Behaviors.Platform.Cnds.OnFall),this._animMode="falling");(h||g)&&0<=this._dy&&("falling"===this._animMode||g||l&&0===this._dy?(this.Trigger(e.Behaviors.Platform.Cnds.OnLand),this._animMode=0===this._dx&&0===this._dy?"stopped":"moving"):("stopped"!==this._animMode&&0===this._dx&&0===this._dy&&
(this.Trigger(e.Behaviors.Platform.Cnds.OnStop),this._animMode="stopped"),"moving"===this._animMode||0===this._dx&&0===this._dy||l||(this.Trigger(e.Behaviors.Platform.Cnds.OnMove),this._animMode="moving")))}_IsMoving(){return 0!==this._GetVectorX()||0!==this._GetVectorY()}_CheckIfStandingOnFloor(){if(0!==this._dy)return!1;const h=this._inst;var g=this.GetWorldInfo();const l=this._runtime.GetCollisionEngine(),m=g.GetX(),u=g.GetY();g.OffsetXY(this._downX,this._downY);g.SetBboxChanged();const w=l.TestOverlapSolid(h);
let q=null;w||0!==this._fallThrough||(q=l.TestOverlapJumpthru(h,!0));g.SetXY(m,u);g.SetBboxChanged();if(w)return!l.TestOverlap(h,w);if(q&&q.length){g=0;for(let t=0,p=q.length;t<p;++t)q[g]=q[t],l.TestOverlap(h,q[t])||g++;if(1<=g)return!0}return!1}_IsByWall(h){const g=this._inst,l=this.GetWorldInfo(),m=this._runtime.GetCollisionEngine(),u=l.GetX(),w=l.GetY();0===h?l.OffsetXY(2*-this._rightX,2*-this._rightY):l.OffsetXY(2*this._rightX,2*this._rightY);l.SetBboxChanged();if(!m.TestOverlapSolid(g))return l.SetXY(u,
w),l.SetBboxChanged(),!1;l.OffsetXY(3*-this._downX,3*-this._downY);l.SetBboxChanged();h=!!m.TestOverlapSolid(g);l.SetXY(u,w);l.SetBboxChanged();return h}_FallThroughJumpThru(){const h=this.GetWorldInfo(),g=h.GetX(),l=h.GetY();h.OffsetXY(this._downX,this._downY);h.SetBboxChanged();const m=this._runtime.GetCollisionEngine().TestOverlapJumpthru(this._inst,!1);h.SetXY(g,l);h.SetBboxChanged();m&&(this._fallThrough=3,this._lastFloorObject=null)}_ResetDoubleJump(h){this._doubleJumped=!h}_GetSpeed(){return Math.hypot(this._dx,
this._dy)}_GetMovingAngle(){return Math.atan2(this._dy,this._dx)}_IsJumping(){return 0>this._dy}_IsFalling(){return 0<this._dy}_SetMaxSpeed(h){this._maxSpeed=Math.max(h,0)}_GetMaxSpeed(){return this._maxSpeed}_SetAcceleration(h){this._acc=Math.max(h,0)}_GetAcceleration(){return this._acc}_SetDeceleration(h){this._dec=Math.max(h,0)}_GetDeceleration(){return this._dec}_SetJumpStrength(h){this._jumpStrength=Math.max(h,0)}_GetJumpStrength(){return this._jumpStrength}_SetMaxFallSpeed(h){this._maxFall=
Math.max(h,0)}_GetMaxFallSpeed(){return this._maxFall}_SetGravity(h){if(this._g1!==h){this._g=h;this._UpdateGravity();h=this._runtime.GetCollisionEngine();var g=this.GetWorldInfo();h.TestOverlapSolid(this._inst)&&(h.PushOutSolid(this._inst,this._downX,this._downY,10),g.OffsetXY(2*this._downX,2*this._downY),g.SetBboxChanged());this._lastFloorObject=null}}_GetGravity(){return this._g}_SetGravityAngle(h){h=e.clampAngle(h);this._ga!==h&&(this._ga=h,this._UpdateGravity(),this._lastFloorObject=null)}_GetGravityAngle(){return this._ga}_SetDoubleJumpEnabled(h){this._enableDoubleJump=
!!h}_IsDoubleJumpEnabled(){return this._enableDoubleJump}_SetJumpSustain(h){this._jumpSustain=h}_GetJumpSustain(){return this._jumpSustain}_SetCeilingCollisionMode(h){this._ceilingCollisionMode=h}_GetCeilingCollisionMode(){return this._ceilingCollisionMode}_SetVectorX(h){this._dx=h}_GetVectorX(){return this._dx}_SetVectorY(h){this._dy=h}_GetVectorY(){return this._dy}_SimulateControl(h){if(this._isEnabled)switch(h){case 0:this._simLeft=!0;break;case 1:this._simRight=!0;break;case 2:this._simJump=!0}}_SetDefaultControls(h){h=
!!h;this._defaultControls!==h&&((this._defaultControls=h)?this._BindEvents():(this._UnBindEvents(),this._OnWindowOrKeyboardBlur()))}_IsDefaultControls(){return this._defaultControls}_SetIgnoreInput(h){this._ignoreInput=!!h}_IsIgnoreInput(){return this._ignoreInput}_SetEnabled(h){h=!!h;this._isEnabled!==h&&((this._isEnabled=h)?this._StartPostTicking():(this._StopPostTicking(),this._lastFloorObject=null,this._simJump=this._simRight=this._simLeft=!1))}_IsEnabled(){return this._isEnabled}GetPropertyValueByIndex(h){switch(h){case 0:return this._GetMaxSpeed();
case 1:return this._GetAcceleration();case 2:return this._GetDeceleration();case 3:return this._GetJumpStrength();case 4:return this._GetGravity();case 5:return this._GetMaxFallSpeed();case 6:return this._IsDoubleJumpEnabled();case 7:return 1E3*this._GetJumpSustain();case 8:return this._IsDefaultControls();case 9:return this._IsEnabled()}}SetPropertyValueByIndex(h,g){switch(h){case 0:this._SetMaxSpeed(g);break;case 1:this._SetAcceleration(g);break;case 2:this._SetDeceleration(g);break;case 3:this._SetJumpStrength(g);
break;case 4:this._SetGravity(g);break;case 5:this._SetMaxFallSpeed(g);break;case 6:this._SetDoubleJumpEnabled(!!g);break;case 7:this._SetJumpSustain(g/1E3);break;case 8:this._SetDefaultControls(!!g);break;case 9:this._SetEnabled(!!g)}}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.platform.debugger.vector-x",value:this._GetVectorX(),onedit:h=>this._SetVectorX(h)},{name:"behaviors.platform.debugger.vector-y",value:this._GetVectorY(),onedit:h=>
this._SetVectorY(h)},{name:"behaviors.platform.properties.max-speed.name",value:this._GetMaxSpeed(),onedit:h=>this._SetMaxSpeed(h)},{name:"behaviors.platform.properties.acceleration.name",value:this._GetAcceleration(),onedit:h=>this._SetAcceleration(h)},{name:"behaviors.platform.properties.deceleration.name",value:this._GetDeceleration(),onedit:h=>this._SetDeceleration(h)},{name:"behaviors.platform.properties.jump-strength.name",value:this._GetJumpStrength(),onedit:h=>this._SetJumpStrength(h)},{name:"behaviors.platform.properties.gravity.name",
value:this._GetGravity(),onedit:h=>this._SetGravity(h)},{name:"behaviors.platform.debugger.gravity-angle",value:e.toDegrees(this._GetGravityAngle()),onedit:h=>this._SetGravityAngle(e.toRadians(h))},{name:"behaviors.platform.properties.max-fall-speed.name",value:this._GetMaxFallSpeed(),onedit:h=>this._SetMaxFallSpeed(h)},{name:"behaviors.platform.debugger.animation-mode",value:["behaviors.platform.debugger.anim-"+this._animMode]},{name:"behaviors.platform.properties.enabled.name",value:this._IsEnabled(),
onedit:h=>this._SetEnabled(h)}]}]}GetScriptInterfaceClass(){return self.IPlatformBehaviorInstance}};const c=new WeakMap,f=new Map([["left",0],["right",1],["jump",2]]);self.IPlatformBehaviorInstance=class extends a{constructor(){super();c.set(this,a._GetInitInst().GetSdkInstance())}fallThrough(){c.get(this)._FallThroughJumpThru()}resetDoubleJump(h){c.get(this)._ResetDoubleJump(!!h)}simulateControl(h){b.RequireString(h);h=f.get(h);if("number"!==typeof h)throw Error("invalid control");c.get(this)._SimulateControl(h)}get speed(){return c.get(this)._GetSpeed()}get maxSpeed(){return c.get(this)._GetMaxSpeed()}set maxSpeed(h){b.RequireFiniteNumber(h);
c.get(this)._SetMaxSpeed(h)}get acceleration(){return c.get(this)._GetAcceleration()}set acceleration(h){b.RequireFiniteNumber(h);c.get(this)._SetAcceleration(h)}get deceleration(){return c.get(this)._GetDeceleration()}set deceleration(h){b.RequireFiniteNumber(h);c.get(this)._SetDeceleration(h)}get jumpStrength(){return c.get(this)._GetJumpStrength()}set jumpStrength(h){b.RequireFiniteNumber(h);c.get(this)._SetJumpStrength(h)}get maxFallSpeed(){return c.get(this)._GetMaxFallSpeed()}set maxFallSpeed(h){b.RequireFiniteNumber(h);
c.get(this)._SetMaxFallSpeed(h)}get gravity(){return c.get(this)._GetGravity()}set gravity(h){b.RequireFiniteNumber(h);c.get(this)._SetGravity(h)}get gravityAngle(){return c.get(this)._GetGravityAngle()}set gravityAngle(h){b.RequireFiniteNumber(h);c.get(this)._SetGravityAngle(h)}get isDoubleJumpEnabled(){return c.get(this)._IsDoubleJumpEnabled()}set isDoubleJumpEnabled(h){c.get(this)._SetDoubleJumpEnabled(!!h)}get jumpSustain(){return c.get(this)._GetJumpSustain()}set jumpSustain(h){b.RequireFiniteNumber(h);
c.get(this)._SetJumpSustain(h)}get ceilingCollisionMode(){return 0===c.get(this)._GetCeilingCollisionMode()?"stop":"preserve-momentum"}set ceilingCollisionMode(h){b.RequireString(h);const g=c.get(this);if("stop"===h)g._SetCeilingCollisionMode(0);else if("preserve-momentum"===h)g._SetCeilingCollisionMode(1);else throw Error("invalid mode");}get isOnFloor(){return c.get(this)._CheckIfStandingOnFloor()}isByWall(h){b.RequireString(h);const g=c.get(this);if("left"===h)return g._IsByWall(0);if("right"===
h)return g._IsByWall(1);throw Error("invalid side");}get isMoving(){return c.get(this)._IsMoving()}get isJumping(){return c.get(this)._IsJumping()}get isFalling(){return c.get(this)._IsFalling()}get vectorX(){return c.get(this)._GetVectorX()}set vectorX(h){b.RequireFiniteNumber(h);c.get(this)._SetVectorX(h)}get vectorY(){return c.get(this)._GetVectorY()}set vectorY(h){b.RequireFiniteNumber(h);c.get(this)._SetVectorY(h)}get isDefaultControls(){return c.get(this)._IsDefaultControls()}set isDefaultControls(h){c.get(this)._SetDefaultControls(!!h)}get isIgnoringInput(){return c.get(this)._IsIgnoreInput()}set isIgnoringInput(h){c.get(this)._SetIgnoreInput(!!h)}get isEnabled(){return c.get(this)._IsEnabled()}set isEnabled(h){c.get(this)._SetEnabled(!!h)}}}
{"use strict";const e=self.C3;e.Behaviors.Platform.Cnds={IsMoving(){return this._IsMoving()},CompareSpeed(b,a){return e.compare(this._GetSpeed(),b,a)},IsOnFloor(){return this._CheckIfStandingOnFloor()},IsByWall(b){return this._IsByWall(b)},IsJumping(){return this._IsJumping()},IsFalling(){return this._IsFalling()},IsDoubleJumpEnabled(){return this._IsDoubleJumpEnabled()},OnJump(){return!0},OnFall(){return!0},OnStop(){return!0},OnMove(){return!0},OnLand(){return!0},IsEnabled(){return this._IsEnabled()}}}
{"use strict";const e=self.C3;e.Behaviors.Platform.Acts={SetMaxSpeed(b){this._SetMaxSpeed(b)},SetAcceleration(b){this._SetAcceleration(b)},SetDeceleration(b){this._SetDeceleration(b)},SetJumpStrength(b){this._SetJumpStrength(b)},SetMaxFallSpeed(b){this._SetMaxFallSpeed(b)},SetGravity(b){this._SetGravity(b)},SimulateControl(b){this._SimulateControl(b)},SetIgnoreInput(b){this._SetIgnoreInput(!!b)},SetVectorX(b){this._SetVectorX(b)},SetVectorY(b){this._SetVectorY(b)},SetGravityAngle(b){this._SetGravityAngle(e.toRadians(b))},
SetEnabled(b){this._SetEnabled(0!==b)},FallThrough(){this._FallThroughJumpThru()},SetDoubleJumpEnabled(b){this._SetDoubleJumpEnabled(0!==b)},SetJumpSustain(b){this._SetJumpSustain(b/1E3)},SetCeilingCollision(b){this._SetCeilingCollisionMode(b)},SetDefaultControls(b){this._SetDefaultControls(b)},ResetDoubleJump(b){this._ResetDoubleJump(b)}}}
{"use strict";const e=self.C3;e.Behaviors.Platform.Exps={Speed(){return this._GetSpeed()},MaxSpeed(){return this._GetMaxSpeed()},Acceleration(){return this._GetAcceleration()},Deceleration(){return this._GetDeceleration()},JumpStrength(){return this._GetJumpStrength()},Gravity(){return this._GetGravity()},GravityAngle(){return e.toDegrees(this._GetGravityAngle())},MaxFallSpeed(){return this._GetMaxFallSpeed()},MovingAngle(){return e.toDegrees(this._GetMovingAngle())},VectorX(){return this._GetVectorX()},
VectorY(){return this._GetVectorY()},JumpSustain(){return 1E3*this._GetJumpSustain()}}}{"use strict";const e=self.C3;e.Behaviors.Rotate=class extends e.SDKBehaviorBase{constructor(b){super(b)}Release(){super.Release()}}}{"use strict";const e=self.C3;e.Behaviors.Rotate.Type=class extends e.SDKBehaviorTypeBase{constructor(b){super(b)}Release(){super.Release()}OnCreate(){}}}
{"use strict";const e=self.C3;e.Behaviors.Rotate.Instance=class extends e.SDKBehaviorInstanceBase{constructor(b,a){super(b);this._acceleration=this._speed=0;this._isEnabled=!0;a&&(this._speed=e.toRadians(a[0]),this._acceleration=e.toRadians(a[1]),this._isEnabled=a[2]);this._isEnabled&&this._StartTicking()}Release(){super.Release()}SaveToJson(){return{s:this._speed,a:this._acceleration,e:this._isEnabled}}LoadFromJson(b){this._speed=b.s;this._acceleration=b.a;this._SetEnabled(b.e)}Tick(){if(this._isEnabled){var b=
this._runtime.GetDt(this._inst);if(0!==b&&(0!==this._acceleration&&(this._speed+=this._acceleration*b),0!==this._speed)){const a=this._inst.GetWorldInfo();a.SetAngle(a.GetAngle()+this._speed*b);a.SetBboxChanged()}}}GetPropertyValueByIndex(b){switch(b){case 0:return e.toDegrees(this._speed);case 1:return e.toDegrees(this._acceleration);case 2:return this._isEnabled}}SetPropertyValueByIndex(b,a){switch(b){case 0:this._speed=e.toRadians(a);break;case 1:this._acceleration=e.toRadians(a);break;case 2:this._SetEnabled(a)}}_SetEnabled(b){(this._isEnabled=
!!b)?this._StartTicking():this._StopTicking()}GetDebuggerProperties(){return[{title:"$"+this.GetBehaviorType().GetName(),properties:[{name:"behaviors.rotate.properties.speed.name",value:e.toDegrees(this._speed),onedit:b=>this._speed=e.toRadians(b)},{name:"behaviors.rotate.properties.acceleration.name",value:e.toDegrees(this._acceleration),onedit:b=>this._acceleration=e.toRadians(b)},{name:"behaviors.rotate.properties.enabled.name",value:this._isEnabled,onedit:b=>this._SetEnabled(b)}]}]}}}"use strict";
self.C3.Behaviors.Rotate.Cnds={IsEnabled(){return this._isEnabled}};{"use strict";const e=self.C3;e.Behaviors.Rotate.Acts={SetSpeed(b){this._speed=e.toRadians(b)},SetAcceleration(b){this._acceleration=e.toRadians(b)},SetEnabled(b){this._SetEnabled(b)}}}{"use strict";const e=self.C3;e.Behaviors.Rotate.Exps={Speed(){return e.toDegrees(this._speed)},Acceleration(){return e.toDegrees(this._acceleration)}}}
{const e=self.C3;self.C3_GetObjectRefTable=function(){return[e.Plugins.Sprite,e.Behaviors.Fade,e.Plugins.Text,e.Behaviors.Sin,e.Plugins.Touch,e.Plugins.Spritefont2,e.Plugins.Audio,e.Plugins.LocalStorage,e.Plugins.TiledBg,e.Behaviors.Anchor,e.Behaviors.solid,e.Behaviors.Tween,e.Behaviors.Platform,e.Behaviors.Rotate,e.Plugins.System.Cnds.OnLayoutStart,e.Plugins.LocalStorage.Acts.CheckItemExists,e.Plugins.Sprite.Acts.SetVisible,e.Plugins.Text.Acts.SetVisible,e.Plugins.TiledBg.Acts.Destroy,e.Plugins.Text.Acts.SetText,
e.Plugins.System.Exps.projectversion,e.Plugins.Audio.Acts.StopAll,e.Plugins.System.Cnds.Compare,e.Plugins.System.Exps.loadingprogress,e.Plugins.System.Exps.imageloadingprogress,e.Plugins.System.Cnds.TriggerOnce,e.Plugins.System.Acts.SetVar,e.Behaviors.Fade.Acts.RestartFade,e.Plugins.System.Acts.Wait,e.Plugins.Touch.Cnds.OnTouchStart,e.Plugins.Text.Cnds.IsVisible,e.Plugins.Touch.Cnds.IsTouchingObject,e.Plugins.System.Acts.GoToLayout,e.Plugins.LocalStorage.Cnds.OnItemExists,e.Plugins.LocalStorage.Acts.GetItem,
e.Plugins.LocalStorage.Cnds.OnItemGet,e.Plugins.LocalStorage.Exps.ItemValue,e.Plugins.LocalStorage.Cnds.OnItemMissing,e.Plugins.Touch.Cnds.OnHoldGestureObject,e.Plugins.LocalStorage.Acts.SetItem,e.Plugins.System.Acts.RestartLayout,e.Plugins.System.Cnds.IsGroupActive,e.Plugins.System.Acts.SetLayerBackground,e.Plugins.Sprite.Acts.MoveToLayer,e.Plugins.Spritefont2.Acts.Destroy,e.Plugins.Sprite.Acts.Destroy,e.Plugins.TiledBg.Acts.SetPos,e.Plugins.System.Exps.layoutwidth,e.Plugins.System.Exps.layoutheight,
e.Plugins.TiledBg.Acts.SetSize,e.Plugins.Sprite.Acts.SetAnimFrame,e.Plugins.Sprite.Acts.SetBoolInstanceVar,e.Behaviors.Platform.Acts.SetEnabled,e.Plugins.System.Cnds.PickAll,e.Plugins.System.Cnds.PickByComparison,e.Behaviors.Tween.Acts.TweenOneProperty,e.Plugins.Sprite.Exps.Y,e.Plugins.Touch.Cnds.OnTouchObject,e.Plugins.Sprite.Cnds.IsVisible,e.Plugins.System.Acts.SetTimescale,e.Plugins.Sprite.Cnds.IsBoolInstanceVarSet,e.Plugins.System.Exps.dt,e.Plugins.System.Acts.CreateObject,e.Plugins.Sprite.Acts.MoveToTop,
e.Plugins.TiledBg.Exps.Count,e.Plugins.System.Cnds.CompareVar,e.Plugins.Audio.Acts.Play,e.Behaviors.solid.Acts.SetEnabled,e.Plugins.Sprite.Acts.SetInstanceVar,e.Behaviors.Tween.Acts.TweenTwoProperties,e.Plugins.Sprite.Cnds.OnCollision,e.Plugins.Sprite.Cnds.CompareFrame,e.Plugins.Sprite.Exps.AnimationFrame,e.Behaviors.Platform.Acts.SetVectorY,e.Plugins.System.Exps.random,e.Plugins.System.Acts.AddVar,e.Plugins.System.Cnds.Repeat,e.Plugins.Sprite.Acts.Spawn,e.Plugins.System.Exps.loopindex,e.Behaviors.Fade.Acts.SetFadeOutTime,
e.Plugins.Sprite.Acts.SetScale,e.Plugins.Sprite.Exps.AnimationFrameCount,e.Plugins.System.Exps.rgb,e.Plugins.System.Exps.int,e.Plugins.System.Cnds.Else,e.Plugins.Text.Acts.MoveToTop,e.Plugins.Text.Acts.SetFontColor,e.Plugins.Sprite.Acts.SetY,e.Plugins.Sprite.Cnds.IsOnScreen,e.Plugins.Sprite.Acts.MoveAtAngle,e.Behaviors.Fade.Acts.SetFadeInTime,e.Behaviors.Fade.Acts.SetWaitTime,e.Plugins.Sprite.Cnds.CompareOpacity,e.Plugins.Audio.Cnds.IsTagPlaying,e.Plugins.System.Exps.layoutname,e.Plugins.Audio.Acts.Stop,
e.Plugins.Audio.Acts.SetSilent,e.Plugins.Sprite.Acts.SetOpacity,e.Plugins.Audio.Acts.SetMasterVolume,e.Plugins.Text.Cnds.IsBoolInstanceVarSet,e.Plugins.Text.Acts.SetBoolInstanceVar,e.Plugins.Text.Acts.SetY,e.Plugins.System.Exps.viewportbottom,e.Plugins.Text.Acts.SetHeight,e.Plugins.Text.Acts.SetFontSize]};self.C3_JsPropNameTable=[{Fade:0},{intro_:0},{Sine:0},{txt_taptocontinue:0},{Touch:0},{debug:0},{Audio:0},{LocalStorage:0},{fade:0},{txt_reset:0},{Anchor:0},{btn_main:0},{btn_sound:0},{btn_music:0},
{pause:0},{btn_pause:0},{bgPaused:0},{b_play:0},{txt_ver:0},{warning:0},{move:0},{Solid:0},{Tween:0},{solids:0},{Platform:0},{ball:0},{bg:0},{txt_score:0},{fontSizeDefault:0},{txt_gameover:0},{Rotate:0},{btn_restart:0},{moveAngle:0},{moveSpeed:0},{ball_part:0},{title:0},{ok:0},{txt_howtoplay:0},{load_ok:0},{storageName:0},{score:0},{hScore:0},{timeMove:0},{delay:0},{rep:0},{Sound:0},{Music:0},{fadeTime:0},{type:0}]}
{function e(b,a){return"string"===typeof b||"string"===typeof a?("number"===typeof b?(Math.round(1E10*b)/1E10).toString():b)+("number"===typeof a?(Math.round(1E10*a)/1E10).toString():a):b&&a?1:0}self.C3_ExpressionFuncs=[()=>"trz_bouncecolor",b=>{const a=b._GetNode(0).GetBoundMethod();return()=>"Version "+a()},b=>{const a=b._GetNode(0).GetBoundMethod();return()=>a()},()=>1,b=>{const a=b._GetNode(0).GetVar();return()=>a.GetValue()},()=>"in",()=>0,()=>"General",()=>"out",()=>"BG",()=>15132390,()=>"Hud",
b=>{const a=b._GetNode(0).GetBoundMethod();return()=>a()/2},()=>1E4,b=>{const a=b._GetNode(0).GetVar(),d=b._GetNode(1).GetVar();return()=>e(e(a.GetValue(),"\n")+"[size=24]Best: ",d.GetValue())},()=>.5,()=>"Functions",b=>{const a=b._GetNode(0);return()=>a.ExpInstVar()},()=>"moveY",b=>{const a=b._GetNode(0);return()=>a.ExpObject()-60},()=>"Buttons",()=>"Gameplay",b=>{const a=b._GetNode(0);return()=>a.ExpObject()},()=>"",()=>780,()=>1020,()=>"scale+",()=>2,b=>{const a=b._GetNode(0).GetVar();return()=>
a.GetValue()/2},b=>{const a=b._GetNode(0).GetVar(),d=b._GetNode(1).GetBoundMethod(),c=b._GetNode(2).GetVar(),f=b._GetNode(3).GetVar();return()=>50<a.GetValue()?d(-850,-950):30<c.GetValue()?-850:20<f.GetValue()?-900:-950},()=>"Main",b=>{const a=b._GetNode(0).GetVar(),d=b._GetNode(1).GetBoundMethod();return()=>360/a.GetValue()*d()},b=>{const a=b._GetNode(0).GetBoundMethod();return()=>a(3,10)},b=>{const a=b._GetNode(0).GetBoundMethod();return()=>a(.2,.7)},b=>{const a=b._GetNode(0).GetBoundMethod();return()=>
a(.5,1)},b=>{const a=b._GetNode(0).GetBoundMethod();return()=>10*a()},b=>{const a=b._GetNode(0).GetBoundMethod(),d=b._GetNode(1);return()=>Math.floor(a(d.ExpObject()))},()=>10,b=>{const a=b._GetNode(0).GetBoundMethod(),d=b._GetNode(1).GetBoundMethod(),c=b._GetNode(2).GetBoundMethod(),f=b._GetNode(3).GetBoundMethod(),h=b._GetNode(4).GetBoundMethod(),g=b._GetNode(5).GetBoundMethod(),l=b._GetNode(6).GetBoundMethod();return()=>a(d(c(185,230)),f(h(185,230)),g(l(185,230)))},b=>{const a=b._GetNode(0);return()=>
2*a.ExpObject()},()=>.125,()=>1140,()=>"Sound and Music",()=>100,b=>{const a=b._GetNode(0).GetVar();return()=>0===a.GetValue()?1:0},()=>"MainMusic",()=>"Loader",()=>25,()=>"ADS",()=>-1E3,b=>{const a=b._GetNode(0).GetVar();return()=>e("High score: ",a.GetValue())},b=>{const a=b._GetNode(0).GetBoundMethod();return()=>a(0)+340},()=>"moveUp",()=>1100,()=>340,()=>"INSTRUCTIONS\n\nThe boucing ball can assume randomly five different colors, you must garantee \u2013 [b]just taping on the screen[/b] \u2013 that the plataform have the same ball color when it bounces, othercase you lose.\n\nGradually the bouncing force of the ball is decreased, therefore increasing the difficulty of the game.",
()=>18]}var module$str$c3runtime={};var module$str$__c3root__={};
